Use Automator to move files and folder structure to another folder, retaining destination contents

I have been struggling trying to setup Automator to move files and folder structure to another folder, retaining the destination contents.  Basically, I need to add files at the destination, within the same folder structure that exists at the source.  Here's some details about the scenario:
-I have PDF files that I create on a seperate computer than I my daily use machine
-For security reasons, the source computer doesn't have access to any shares on the destination computer
-The destination computer has access to shares on the source computer
-I want to delete the original PDFs at the source after they are moved or copied
I haven't been able to get Automator to move or copy the folder contents (files and subfolders) without dropping everything copied at the top level of the destination, resulting in many duplicate folders and a broken folder structure.
So far I've only had luck getting this to work at the command line, but I'd really like to have this setup in Automator so that I could have either a service or application that I could use for any folder, prompting for the source and destination folders.  I'm a relatively new Mac user with limited Linux experience, so this is the command that I've cobbled together and currently accomplishes what I'm looking for:
ditto /Volumes/SMB_Temp/SOURCE ~/Desktop/Documents/DESTINATION
cd /Volumes/SMB_Temp/SOURCE
find . -type f -name "*.pdf" -exec rm -f {} \;
Thanks for any ideas!

If you have a command-line syntax that works, why not just create an Automator workflow with a single 'Utilities -> Run Shell Script' action, where that action has your (working) shell commands?
Seems way, way simpler to me than trying to reinvent the wheel and transcribe shell commands into individual Automator actions

Similar Messages

  • Dragging a file and holding it over another folder doesnt open the folder..

    As I say in the title of the thread I have the following problem with my install of leopard that started to happen suddenly without any specific reason as fas as i can say... I cannot open a folder while holding another folder or file above the folder i want to open... I tried to repair permissions but it didnt make any difference..
    Any ideas why this happens? Or a way to fix it?
    Thanx for ur time...

    go to finder preferences->general and make sure the the box "spring-loaded folders and windows" is checked. if it's checked already uncheck and recheck it. also, set the springloading speed to medium.

  • Use Automator to move files to trash

    I've spent quite a bit of time trying to work out how to move files with automator to another folder - finally worked this out using a folder action.
    I am now trying to do similar, but this time using a folder action to move files to the trash.  Again, I don't seem to be getting this right.  I have the following:
    There are definitely files in the folder that meet the criteria - but the workflow is not working.  Any suggestions, please?
    Cheers,
    Mike

    sdiaz34 wrote:
    The external hard drive was partitioned to have a back up drive for time machine and another drive for other (pics&vids) use.
    If it is possible can the automator task then trash all files in original pictures subfolder when task is complete to avoid any memory use on macbook air?
    You really don't want to do that. 
    You'll have only one copy of the files, on the external HD.  When (not if) it fails, they'll be lost.  
    For best results, get another external HD for your photos.  Then let Time Machine back up both your internal HD and the external.  See Time Machine - Frequently Asked Question #32 for details.

  • I was wondering if it was possible to use Automator to move files based on the filename.

    Hi,
    I'm kind of new to Automator and I'm trying to come up with a sequence that will severely save me a few hours a day moving files from two larger folders into smaller folders. Basically the setup is that I have two folders, one constantly being populated with images and the other with video files. They each have file names starting with a two digit number (i.e. 12, 11, 10...) or "BG" and then a two digit number (i.e. BG12, BG11, BG10...) with the digits corresponding to a year. Essentially, I'd need to move the files into folders corresponding to the year (i.e. files starting with BG12 and 12 would be moved to 2012, files starting with BG11 and 11 would be moved to 2011, etc). As it stands now, I've only been able to get the 2012 folder populated. Any help would be greatly appreciated. Thanks.

    Hi,
    Here's a solution that uses a script, because it is not possible, at least to make twenty or more Workflows
    In Automator :
    Create a new worflow.
    Add the action "Run Shell Script", select "/bin/bash" in the popup menu
    Cut the text in the action.
    Copy/paste this script in the action :
    targetsDir=('/Users/jack/Desktop/MyImagesFolder' '/Users/jack/Desktop/MyVideosFolder')
    destDir=('/Users/jack/Desktop/yearImageFolder' '/Users/jack/Desktop/yearVideoFolder')
    for i in 0 1;do
          subfolder="${destDir[$i]}"/20
          for each in "${targetsDir[$i]}"/*;do
                if [ ! -d "$each" ];then ## not a directory
                      name=${each##*/};
                      if [[ $name =~ ^([0-9]{2})|^..([0-9]{2}) ]]; then
                            [[ $name =~ ([0-9]{2}) ]] && year=${BASH_REMATCH[1]};
                            /bin/mv -n "$each" "$subfolder$year"
                      fi
                fi
          done
    done
    Replace the paths in the first line by the path of your Images Folder  and Video Folder, use drag/drop between the simple quote ''
    Replace the paths in the second line by the path of your destibation Folders, use drag/drop between the simple quote ''.
    This script will not overwrite existing files, If you want to replace the existing file, use the /bin/mv -f instead of /bin/mv -n
    That's it.

  • Problems using CFFile to move files

    Hi there - I am having some problems using CFFile to move
    files from one directory to another. It only seems to only move
    some of the files in the group that I choose to move over, and
    there is nothing specific about which files are moved - different
    files are moved each time. There are no error messages that are
    showing up, so I am totally baffled. Has anyone else experienced
    this or does anyone else have any ideas on how to fix this problem?
    Any help would be much appreciated!! My code is below.

    First, an incidental matter. I don't think there's any need
    for so many try-catch tags. I would expect all the tags <cffile
    action="move"> to throw the same class of exception, and so
    would use one try-catch for them all. Even if you expect different
    exceptions to be thrown, one cftry tag might still be sufficient,
    if implemented as follows
    <cftry>
    <!--- code block 1 --->
    <!--- code block 2 --->
    <!--- ... etc... --->
    <cfcatch type="exceptionType1"></cfcatch>
    <cfcatch type="exceptionType2"></cfcatch>
    <!--- ... etc... --->
    </cftry>
    I suspect the cause of the problems lies in the dynamic
    values that you give the attributes. Perhaps incorrect values are
    passed for the source and/or destination values in certain
    circumstances. As A3gis has said, if that were to happen you
    probably wouldn't notice, because of the try-catches. Find a way to
    ensure that all the generated values for source and destination are
    correct.

  • When trying to move file and use command and drag, it doesn't move the file just creates a short cut.

    When trying to move file and use command and drag, it doesn't move the file just creates a short cut.

    Using command creates a copy.
    If you want to just move a file, click on it, hold it and drag it to the new location.

  • Jsp code (js code) to display(tree) the files and sub folders in a folder

    Hi all
    plz can any one send me the source in jsp or js to display in tree structure for files and sub folders in a folder.

    There are dozens of Javascript tree widgets available on the Internet. Some are free. Some are good. Google will find them for you.
    (The only relevance of JSP to your question is that yes, you can generate HTML that uses one of those Javascript tree widgets.)

  • HT1449 Can I just move my movie files and leave my music files where they are?

    Can I just move my movie files and leave my music files where they are?

    Yes, but bear in mind if you move the movie files, any files, from the iTunes media folder iTunes will not know where they are and therefore cannot access them. It will be up to you to tell iTunes were they are in order to use the files.

  • Script to take every 5th file from a folder and copy it to another folder

    How can I tell applescript to take every 5th file of a folder of say 2000 files and copy them to another location? I want to copy the 5th, 10, 15th, 20th files and so on of 2000 files so I will have only 400 files.
    I guess I want to make a list of all the files and then coerce that to the first and then increments of five but how do I do that?
    Thanks.
    Pedro

    Hi Pedro,
    The following script should do what you are asking for:
    *set theSourceFolder to choose folder with prompt "Select the source folder."*
    *set theTargetFolder to choose folder with prompt "Select the target folder."*
    *tell application "Finder"*
    *set theFiles to files of theSourceFolder*
    *repeat with k from 5 to (count theFiles) by 5*
    *move item k of theFiles to folder theTargetFolder*
    *end repeat*
    *end tell*
    Message was edited by: Pierre L.

  • Hi apple users, I am in need of your expertise. I have a mov file and mp4 file which I need converted to DVD. However IDVD quality is terrible and wondering if anyone can help!?

    Hi apple users, I am in need of your expertise. I have a mov file and mp4 file which I need converted to DVD. However IDVD quality is terrible and wondering if anyone can help!?
    I created project in iMovie then exported it to MP4 and also MOV file at highest definition possible + I added it to iDVD and had a number issues about encoding errors regarding the mp4 file. MOV worked but the quality was terrible.....
    MOV file is as follows:
    4.08GB
    Codecs: H.264, ACC
    Colour Profile: HD (1-1-1)
    Dimensions: 1920 x 1080
    Duration: 12:33
    Audio Channels: 2
    MP4 File is as follows:
    3.02GB
    Codecs: H.264, ACC
    Colour Profile: HD (1-1-1)
    Dimensions: 1280 x 720
    Duration: 12:33
    Audio Channels: 6
    I have a MacBook Pro using the Yosemite system upgrade.
    I have updated iDVD and iMovie.
    I even bought the iSkysoft app from the mac store and that was terrible too.
    PLEASE HELP i am getting desperate and about to launch this macbook into the air
    2.66 GHz Intel Core i7
    Version 10.10. 2

    First of all, Hunt--thanks for responding!
    "First, where are you playing the MPEG-2, that you see that jitter?"
    On both a MacBook Pro, an Acer laptop and my Mac Tower. I would love to think that it is a problem with the playback system, and that if I merely send the file off to the duplicator they won't have the same problem. Maybe that is the case...I don't know if I have a choice rather than sending it off to see. But it happens in the same spots, in the same way, on all three of the players so I'm a little reluctant to have faith.
    "Another thing that can cause jitter in an MPEG-2 is the Bit-Rate - higher the Bit-Rate, the better the quality, but the larger the file. For a DVD, one is limited by the total Bit-Rate (both Audio & Video), but with longer prodcutions, some users choose too low a Bit-Rate. If this is the issue, one would need to go back to the original Project and do a new Export/Share."
    Of course, but in the case there is no more 'original project.' It is gone like the wind, stolen along with his computer and backups.
    I think I am stuck using one of two files as my master: a DVD he burned where I only see the stutter/vibration/jitter once, or the mpeg2 file where I see it three times. Hopefully, the duplication house can rip if off of one of them and not see the jitter. I know that in audio, my personal filed, you can do a lot to enhance already existing sound--EQ, compression, tape saturation emulation software, etc. I guess I'm hoping there is some kind of analog to the video world that address jitter after a source has been printed--if indeed the source has been printed to be jittery.
    Thanks,
    Doug

  • Ssis - move files from one directory to another and rename destination file if present

    Hello,
    How is it possible to move files from one directory to another directory and if the file already exists in destination directory then rename it?
    Thanks

    1. Use a foreach loop with file enumerator pointing to first directory.
    Inside loop have a ssis variable of type string to get filename (@[User::FileName])
    Choose option as Fully Qualified in loop
    2. Add another variable called @[User::DestFileName], set EvaluateAsExpression true for it and set expression like this
    REPLACE(@[User::FileName],<source directory path>,<destination directory path>)
    put actual paths in above expression in your case
    and another variable called @[User::RenameFileName], set EvaluateAsExpression true for it and set expression like this
    REPLACE(@[User::FileName],".","_old.")
    3. Create a boolean variable say @[User::FileEXists]
    4. Add a Script Task inside the loop and pass @DestFileName variable in ReadOnly mode and FileExists in ReadWrite mode
    Inside Script Task write code as per below
    http://blog.dbandbi.com/2013/11/13/check-file-exists-ssis/
    5. Add File System Task choose operation as Rename File, Select IsSourcePathVariable as true and select @[user::DestFileName] variable and IsDestinationPath variable as true and select @[user::RenameFileName] variable
    6. Choose ExpressionAndConstraint option for precedeence constraint from ScriptTask to above File System Task and choose constraint as OnSuccess and expression as
    @FileExists == True
    7. Add another File System task with operation as Move File Select IsSourcePathVariable as true and select @[user::FileName] variable and IsDestinationPath variable as true and select @[user::DestFileName] variable. Join Script Task as well as
    File System Task above to this task and choose constraint as OnSuccess and Multiple Constraint option as Or (dotted line)
    Then once executed it will work as per your requirement
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • I keep getting an error code while trying to import a cd to my itunes: Error occurred while converting the file. The disc you are attempting to use is full. removing files and emptying the recycle bin will free up additional space.  What does this mean?

    I keep getting this error code while trying to import a cd to my itunes: "Error occurred while converting the file. The disc you are attempting to use is full. removing files and emptying the recycle bin will free up additional space."  What does this mean?

    Well it probably means exactly what it says... How much free space is there on your hard drive where the iTunes Media folder resides? I believe there is also an obscure bug that can occur when software doesn't read the true value of the free space properly, and the workaround is, perversely, to duplicate some content so that with less actual free space the software in question perceives it as more. I've no idea if iTunes is affected by such a bug.
    tt2

  • I would like to use FireWire to move files between 2 iBook G3's.

    I would like to use FireWire to move files between 2 iBook G3's but the disk icon for the target disk computer does not show on the other. I've tried using 3 different iBooks and 2 different Firewire cables. Are there any other settings I should use?  Any ideas?
    Thanks in advance,
    Mike

    Check the settings in the General tab of the Finder's preferences, and whether or not the drive appears in the Disk Utility.
    (79213)

  • In Quicktime Pro I try to create a mov file and I get an error "-43 a file could not be found".  Any ideas?

    In Quicktime Pro I try to create a mov file and I get an error "-43 a file could not be found".  Any ideas?

    I have a similar problem which i did not have before...and it exists only in some powerpoint files which i want to print as a pdf file...and i get the same message as above.
    the log says the bellow details...what's the problem and how can i resolve it? thanks.
    %%[ ProductName: Distiller ]%%
    %%[Page: 1]%%
    %%[Page: 2]%%
    Cambria not found, using Courier.
    %%[ Error: invalidfont; OffendingCommand: show ]%%
    Stack:
      %%[ Flushing: rest of job (to end-of-file) will be ignored ]%%

  • Need to convert music videos that are tagged as "Movies" and re-rag them as "Music Videos" to get them out of my movies library and into the Music Video folder. Likewise, I ha e some educational videos that belong in "Podcasts." Help?

    Need to convert music videos that are tagged as "Movies" and re-rag them as "Music Videos" to get them out of my movies library and into the Music Video folder. Likewise, I have some educational videos that belong in "Podcasts." Help?

    Select/highlight the ones that you want to change in your iTunes library, do Get-Info (control-I) and change their Media Kind on their Options tab to 'Music Video' - and then similarly for the podcasts.

Maybe you are looking for

  • Deisgn - Objects stop moving with arrow keys until a relaunch

    In design mode, CR 2008, line objects and other design objects stop moving with the arrow keys and won't move more than one position until I either click on the object again and move it one position or I exit CR and relaunch that report. If I move a

  • Ipad Video Out

    Hello, I have a question that I'm hoping someone could solve for me, so here goes: I currently have an ipad 4.  I previously had an ipad 2.  When I still had the ipad 2, i had an apple cable that allowed me to do video/audio out (via 30 pin to compos

  • How to calculate total value in categories?

    I know Numbers let you do subtotal in categories. However at the end of the table, i want a nice total value in a single row that is not in under any category. For example, Number's Home Inventory Template, when you want open a new file. It has Maste

  • NPD - no chance to attach files for no signature requestees

    Hello, Please see here below the following scenario: ACTIVITY: RISK ASSESSMENT ACTYVITY TYPE: DOCUMENT COLLABORATION IN PLACE EDITING TEAM MEMBERS: they are not entered at activity template level but they are assigned at project level OWNER in step 2

  • I have windows vista and bonjour file needs to be removed to update itunes version to 10.5.2

    I have windows vista and a bonjour file needs to be removed to update itunes 10.5.2.