LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices



Reply
 
Search this Thread
Old 12-11-2011, 01:59 AM   #1
congos
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 go.my 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

#!/bin/bash
From=/home/katy/doc
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"
fi
cd $From
find path -type f -name"*.mp4" -exec mv {} $To \;
 
Old 12-11-2011, 02:20 AM   #2
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,219

Rep: Reputation: 578Reputation: 578Reputation: 578Reputation: 578Reputation: 578Reputation: 578
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.


edited
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 02:26 AM.
 
  


Reply

Tags
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 07:49 AM
Moving directories to new directories keysorsoze Linux - Newbie 2 03-31-2006 08:14 PM
An easy way of moving /home and other directories 1kyle Suse/Novell 1 09-23-2005 03:53 AM
moving directories with FTP illiniguy3043 Linux - Software 2 07-08-2004 01:37 AM
Moving directories to their own partitions bxb32001 Debian 7 12-08-2003 07:40 AM


All times are GMT -5. The time now is 01:25 PM.

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