Find the answer to your Linux question:
Results 1 to 4 of 4
I have series of files one.txt two.txt three.txt four.txt and so on into the directory TXT, I want to move these files to TXT.BACKUP directory like one.txt.backup two.txt.backup three.txt.backup four.txt.backup.... ...
  1. #1
    Just Joined!
    Join Date
    Jun 2008
    Posts
    19

    Move directory of files

    I have series of files

    one.txt two.txt three.txt four.txt and so on into the directory TXT,

    I want to move these files to TXT.BACKUP directory like

    one.txt.backup two.txt.backup three.txt.backup four.txt.backup....

    can anyone guide me......

  2. #2
    Linux Guru Jonathan183's Avatar
    Join Date
    Oct 2007
    Posts
    2,941
    I suggest you cp the files to the new location and rename them ... try
    Code:
    man cp rename

  3. #3
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by siva19185 View Post
    I have series of files

    one.txt two.txt three.txt four.txt and so on into the directory TXT,

    I want to move these files to TXT.BACKUP directory like

    one.txt.backup two.txt.backup three.txt.backup four.txt.backup....

    can anyone guide me......
    Code:
    for i in /path/to/TXT/*; do echo mv "$i" "/path/to/TXT.BACKUP/$(basename ${i}).backup"; done
    If you like the results, remove the "echo" to actually do the work.

  4. #4
    Just Joined!
    Join Date
    Jun 2008
    Posts
    19
    Thank u pals...

    It's work very well..

Posting Permissions

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