Find the answer to your Linux question:
Results 1 to 2 of 2
Please help need a script to achieve saving multiple text files as 0001 0002 0003 etc. or moving files to a folder displayed this way.. there prolly is an " ...
  1. #1
    Just Joined!
    Join Date
    Apr 2010
    Location
    NJ
    Posts
    1

    Need to save textfile'$+1'.txt

    Please help need a script to achieve saving multiple text files as 0001 0002 0003 etc.


    or moving files to a folder displayed this way..

    there prolly is an " if " statement involved also...

    if 0001 exist then %+1 and so on.


    Any help will be greatly appreciated,

    Thanks in advance,
    joe

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    I don't understand. To generate files 0001 to some file n, all you have to do is:
    Code:
    for num in $(seq -w 0001 0100); do
        touch "$num"
    done
    This would create files 0001 to 0100.
    DISTRO=Arch
    Registered Linux User #388732

Posting Permissions

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