Results 1 to 4 of 4

Thread: List Of FIles

  1. #1
    Join Date
    Apr 2004
    Posts
    6

    Red face Unanswered: 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.

  2. #2
    Join Date
    Mar 2004
    Posts
    10

    Re: List Of FIles

    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.

  3. #3
    Join Date
    Apr 2004
    Posts
    6

    Re: List Of FIles

    i prove it , but it's not ok.Help
    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.

  4. #4
    Join Date
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: List Of FIles

    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 11:25.

Posting Permissions

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