Linux.com

jackoo

jackoo

  • Linux.com Member
  • Posts: 3
  • Member Since: 06 Dec 11
  • Last Logged In: 04 Jan 12

Latest Posts

Posted by
Topic
Post Preview
Posted
  • jackoo
    RE: bash command line job...
    All files out of 1005 random directories (called "Foto's") are moved to its upper directory and all 1005 empty dir. "Foto's" are removed by following command: find ./ -name "Foto\'s" | ./script.b Down here the content of the file script.b (thanks to MARC! :-) --------------------------------------------- while read -r directories ; do { mv "${directories}"/* "${directories}"/.. || { echo "Could not move files from ${directories}"; exit 1;} rmdir "${directories}" || {echo "Could not remove directory ${directories}"; exit 1;} } done ---------------------------------------------
    Link to this post 04 Jan 12

    All files out of 1005 random directories (called "Foto's") are moved to its upper directory and all 1005 empty dir. "Foto's" are removed by following command:


    find ./ -name "Foto\'s" | ./script.b


    Down here the content of the file script.b (thanks to MARC! :-)
    ---------------------------------------------
    while read -r directories ; do {

    mv "${directories}"/* "${directories}"/.. || { echo "Could not move files from ${directories}"; exit 1;}

    rmdir "${directories}" || {echo "Could not remove directory ${directories}"; exit 1;}

    } done
    ---------------------------------------------

  • jackoo
    RE: bash command line job...
    Cool thanx! Needed this, will try it tonight and let you know :-)
    Link to this post 06 Dec 11

    Cool thanx! Needed this, will try it tonight and let you know :-)

  • jackoo
    bash command line job...
    Hi all, I don't get it working, following is my problem: I have a LOT of directories with 631000 files (.JPG) in it. Quite some directories have SUB-directories called "Foto's". What I like to do is FIND all those SUB-directories out of the bunch directories, copy all the files out of that "Foto's" directory to 1 level higher and remove the just empty "Foto's" directory. Following works: find / -name ./mnt/www/ -name Foto\'s I get a list of all the Directories I like to get rid of...but first the files in these directories I have to copy a level higher. Who can help me out please?? Greetz, Jackoo
    Link to this post 06 Dec 11

    Hi all,

    I don't get it working, following is my problem:

    I have a LOT of directories with 631000 files (.JPG) in it. Quite some directories have SUB-directories called "Foto's".

    What I like to do is FIND all those SUB-directories out of the bunch directories, copy all the files out of that "Foto's" directory to 1 level higher and remove the just empty "Foto's" directory.

    Following works:
    find / -name ./mnt/www/ -name Foto\'s

    I get a list of all the Directories I like to get rid of...but first the files in these directories I have to copy a level higher. Who can help me out please??

    Greetz,
    Jackoo

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board