If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > List Of FIles

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-20-04, 05:54
sistemi sistemi is offline
Registered User
 
Join Date: Apr 2004
Posts: 6
Red face List Of FIles

I have to move 300000 files of 500000 (example filename =*2002*.PDF)
from a directory to another .
How can i do?
when i make a list with ls command ,i obtain the parameter list is too long.
Reply With Quote
  #2 (permalink)  
Old 04-20-04, 08:11
rkrishnan73 rkrishnan73 is offline
Registered User
 
Join Date: Mar 2004
Posts: 10
Re: List Of FIles

Quote:
Originally posted by sistemi
I have to move 300000 files of 500000 (example filename =*2002*.PDF)
from a directory to another .
How can i do?
when i make a list with ls command ,i obtain the parameter list is too long.
This should create a list of files with the move command against it.

while `ls -l *.pdf | awk '{print $9}'` in fileName
do
echo mv "$fileName" /destination_directory > mvfile.bat
done

Once the above is done, chmod the mvfile.bat to executable and run the script.
Reply With Quote
  #3 (permalink)  
Old 04-20-04, 09:46
sistemi sistemi is offline
Registered User
 
Join Date: Apr 2004
Posts: 6
Re: List Of FIles

i prove it , but it's not ok.Help
Quote:
Originally posted by rkrishnan73
This should create a list of files with the move command against it.

while `ls -l *.pdf | awk '{print $9}'` in fileName
do
echo mv "$fileName" /destination_directory > mvfile.bat
done

Once the above is done, chmod the mvfile.bat to executable and run the script.
Reply With Quote
  #4 (permalink)  
Old 04-20-04, 09:52
ika ika is offline
Registered User
 
Join Date: Oct 2003
Location: Slovakia
Posts: 482
Re: List Of FIles

Quote:
Originally posted by rkrishnan73
This should create a list of files with the move command against it.

while `ls -l *.pdf | awk '{print $9}'` in fileName
do
echo mv "$fileName" /destination_directory > mvfile.bat
done

Once the above is done, chmod the mvfile.bat to executable and run the script.
simplest solution (run it from relevant dir):

find . -type f -name '*.pdf' | awk {'print "mv "$1" /otherdir"'} | sh

or the simplest ever(run it from relevant dir):

find . -type f -name '*.pdf' -exec mv {} /otherdir \;

Last edited by ika; 04-20-04 at 10:25.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On