Results 1 to 5 of 5
  1. #1
    Move files in a list...
    Antares's Avatar
    Member Since
    Oct 19, 2009
    Posts
    17
    Specs:
    MacBook Pro 13" 2.53GHz 4GB OSX 10.6
    Move files in a list...
    Hi

    I hope this is the correct forum to ask my question...
    I have to work with a bunch of files but those files are named in a...stupid way. Fortunately I'm able to list all files with certain parameters in a list, but what I want to do now is to move only the files which are mentioned in such a list to another directory.

    Is there a bash command which can do this? To move only the files mentioned in a list?

    cheers

  2. #2
    Move files in a list...
    scathe's Avatar
    Member Since
    Jan 12, 2009
    Location
    Prague, Czech Republic
    Posts
    1,096
    Specs:
    2,4Ghz 15" unibody
    Why not move directly without creating a list using wildcards? Would that be a solution?

    e.g.:
    mv ./*stupid_name*.txt ./folder

  3. #3
    Move files in a list...
    Antares's Avatar
    Member Since
    Oct 19, 2009
    Posts
    17
    Specs:
    MacBook Pro 13" 2.53GHz 4GB OSX 10.6
    Well, thats the reason why I ask this question in the first place. The files have different parameters which are not reflected in their names...

    say you have files named like this:

    1.fits
    2.fits
    3.fits
    4.fits
    ...
    456.fits
    457.fits

    but only a subgroup of them belongs together. Its possible for me to create lists of all files with one particular parameter, but not moving them with wildcards because of the filenames...

  4. #4
    Move files in a list...
    scathe's Avatar
    Member Since
    Jan 12, 2009
    Location
    Prague, Czech Republic
    Posts
    1,096
    Specs:
    2,4Ghz 15" unibody
    Quote Originally Posted by Antares View Post
    ...but only a subgroup of them belongs together. Its possible for me to create lists of all files with one particular parameter, but not moving them with wildcards because of the filenames...
    How do you create these lists? If it's some sort of "find" or "grep" then you can use wildcards. Are you saying you create these lists manually?

    Please give another example of these parameters, I'm thinking no matter how you create that list (if it's with bash) you should be able to use that as the source part for mv.

  5. #5
    Move files in a list...
    scathe's Avatar
    Member Since
    Jan 12, 2009
    Location
    Prague, Czech Republic
    Posts
    1,096
    Specs:
    2,4Ghz 15" unibody
    Ok I will stop tormenting you, there is another option. Look at the following script:
    Code:
    for i in `cat list`
    do
    mv `echo $i` <destination>/`echo $i`
    done
    Keep in mind you need to save that in a file and add execute permissions with chmod +x. I'm not sure how comfy you are with scripting, so let me know if you need additional info as to how to run this.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Can't Move Files to Trash
    By jennyald in forum OS X - Operating System
    Replies: 2
    Last Post: 02-25-2010, 11:02 PM
  2. Trying to Move Files (did I do it right?)
    By liliajams in forum Running Windows (or anything else) on your Mac
    Replies: 3
    Last Post: 01-07-2010, 04:56 PM
  3. Cannot move files
    By Banksy in forum OS X - Operating System
    Replies: 1
    Last Post: 05-25-2009, 02:07 AM
  4. Folder icon has a small lock....cannot move files or move to trash
    By gagliano3 in forum OS X - Operating System
    Replies: 3
    Last Post: 05-02-2009, 11:27 PM
  5. move vs copy files
    By skier19 in forum OS X - Apps and Games
    Replies: 2
    Last Post: 04-02-2008, 02:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •