Find the answer to your Linux question:
Results 1 to 3 of 3
I'm not too sure how to explain what I'm trying to do. I'll eventually open up some sed and awk books, but at the moment, I don't know how to ...
  1. #1
    Linux User Agent-X's Avatar
    Join Date
    May 2005
    Location
    Dimension X
    Posts
    261

    A script that renames a folder to an integer after some other steps...

    I'm not too sure how to explain what I'm trying to do. I'll eventually open up some sed and awk books, but at the moment, I don't know how to do what I want.

    prestart: mount /dev/something1

    1. Rename */foldername/ to an integer stored in a file.
    2. Pull integer from file.
    3. If integer in file = 0, which is the default for just beginning, then rename folder to */1/
    4. Store proof of integer change in file. Integer in file turns into 1.
    5. Transfer files from */1/ to external medium
    6. Delete */1/
    7. umount /dev/something1

    new start:

    1. mount /dev/something1
    2. Rename */foldername/ to an integer stored in the previously mentioned file
    3. Since stored integer = 1, rename folder to */2/
    4. Store proof of integer change in file. Integer in file turns into 2.
    5. Transfer files from */2/ to external medium
    6. Delete */2/
    7. umount /dev/something1

    You've got the idea, I guess.

    */foldername/ is never a number. It uses letters.

  2. #2
    tpl
    tpl is offline
    Linux User
    Join Date
    Jan 2007
    Location
    cleveland
    Posts
    452
    why not just copy the files over--what's the
    point of renaming a directory that is soon rm'ed?
    the sun is new every day (heraclitus)

  3. #3
    Linux User Agent-X's Avatar
    Join Date
    May 2005
    Location
    Dimension X
    Posts
    261
    Speed. If you do the process over 30 times, you start to get annoyed.

    I decided to not waste my time looking for the answer.
    I'll just create 30+ batch scripts that replace each other.
    It's faster since I'll only need to change 2 variables in each script.

Posting Permissions

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