Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-11-2011, 12:59 AM   #1
LQ Newbie
Registered: Oct 2011
Posts: 20

Rep: Reputation: Disabled
Post moving files to different directories

im trying to move media and other files which are in a specified directory to another directory and create another one if it does not exits(where the files will go),them also create a directory will the remaining files with different extensions will first problem is that my script is not making a new directory and it is not moving the files to other directories and what code can i use to move files with different extensions to one directory? this is what i have had so far,correct me where im wrong and help modify my script

To=/home/katy/mo #directory where the media files will go
WA=/home/katy/do # directory where the other files will go
if [ ! -d "$To" ]; then
mkdir -p "$To"
cd $From
find path -type f -name"*.mp4" -exec mv {} $To \;
Old 12-11-2011, 01:20 AM   #2
LQ Addict
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,838

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
mv /home/username/doc /home/katy/mo will create /home/katy/mo/doc which you can rename "doc", if you have media & docs you can create a new folder within doc & add the new folder to command to move for example /home/username/doc/newfolder.

After looking at other posts made by you I believe that the answer I provided may not be the answer that you were looking for.
Opening new thread on same subject is not the way to get the answer, stay persistant & supply the information requested on previous post & that person may have the answer you desire.

Last edited by EDDY1; 12-11-2011 at 01:26 AM.


bash, ubuntu, unix

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Moving files and directories except few moyorakkhi Linux - Newbie 2 10-25-2011 06:49 AM
Moving directories to new directories keysorsoze Linux - Newbie 2 03-31-2006 07:14 PM
An easy way of moving /home and other directories 1kyle SUSE / openSUSE 1 09-23-2005 02:53 AM
moving directories with FTP illiniguy3043 Linux - Software 2 07-08-2004 12:37 AM
Moving directories to their own partitions bxb32001 Debian 7 12-08-2003 06:40 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:15 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration