New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Move files in a list...


Post Reply New Thread Subscribe

 
Thread Tools
Antares

 
Antares's Avatar
 
Member Since: Oct 19, 2009
Posts: 17
Antares is on a distinguished road
Mac Specs: MacBook Pro 13" 2.53GHz 4GB OSX 10.6

Antares is offline
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
QUOTE Thanks
scathe

 
scathe's Avatar
 
Member Since: Jan 12, 2009
Location: Prague, Czech Republic
Posts: 1,096
scathe is a jewel in the roughscathe is a jewel in the rough
Mac Specs: 2,4Ghz 15" unibody

scathe is offline
Why not move directly without creating a list using wildcards? Would that be a solution?

e.g.:
mv ./*stupid_name*.txt ./folder
QUOTE Thanks
Antares

 
Antares's Avatar
 
Member Since: Oct 19, 2009
Posts: 17
Antares is on a distinguished road
Mac Specs: MacBook Pro 13" 2.53GHz 4GB OSX 10.6

Antares is offline
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...
QUOTE Thanks
scathe

 
scathe's Avatar
 
Member Since: Jan 12, 2009
Location: Prague, Czech Republic
Posts: 1,096
scathe is a jewel in the roughscathe is a jewel in the rough
Mac Specs: 2,4Ghz 15" unibody

scathe is offline
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.
QUOTE Thanks
scathe

 
scathe's Avatar
 
Member Since: Jan 12, 2009
Location: Prague, Czech Republic
Posts: 1,096
scathe is a jewel in the roughscathe is a jewel in the rough
Mac Specs: 2,4Ghz 15" unibody

scathe is offline
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.
QUOTE Thanks

Post Reply New Thread Subscribe


« Doing Serial port programming on MAC 10.6 | Window manager crashes when I run the program I'm making. How do I debug? »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
List view vs. Icon view - can't see all files =^o.o^= Switcher Hangout 8 01-20-2007 07:39 PM
Files Lost during Profile Move SITF OS X - Operating System 0 10-17-2006 04:54 PM

All times are GMT -4. The time now is 04:45 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?