Script for moving specific folders

Discussion in 'Programming/Scripts' started by jimitris, Dec 3, 2010.

  1. jimitris

    jimitris New Member

    Hello all,

    First let me say that I've searched around the net and can't seem to find exactly what I'm looking for, so sorry if this exists somewhere in the forums.

    I have a folder that contains about 2000 sub-folders. I need to move some of the sub-folders to a different location and I would like some guidance in making a script that will move the sub-folders I specify in a text file to the other location.

    I am working on Open Suse 10.3.

    Thanks in advance
  2. jimitris

    jimitris New Member

    Hi all, found a simple way to do it after all with a bit of altered functionality for added data security

    I'm posting it just in case someone needs to do something similar

    This will copy the folders specified in the folders.txt file to a different location and rename the folders in the old location


    for FOLDERS in `cat folders.txt`

    cp -r $FOLDERS /destination/dir
    mv $FOLDERS $FOLDERS"_old"


Share This Page