General :: Move Folders That Contain A File With A Specific Extension To A Destination Folder?

Oct 3, 2010

Many years ago, I converted a portion of my files to an arbitrary format with a specific extension. i no longer desire to have them in this format and i would like begin the process of replacing them because conversion is not an appropriate solution. unfortunately, they are mixed in separate folders of the same root folder with files in my current format of a different extension. I feel it would make this process easier if I were to move every folder that contained a file with the undesired format to a separate root folder. The files are stored on a Linux server and shared via samba. How can I do this with a couple of commands or a script? I am open to other suggestions as well. I want to avoid time spent editing text files. Ultimately, I'd like a command that produced a list of full paths for folders, sorted by the number of levels would be a nice touch. A list of all of the files is clearly not what I'm looking for.

View 2 Replies


ADVERTISEMENT

General :: Write A Script To Move Specific Files In Various Folders To One Folder?

Nov 16, 2010

Terribly new to Linux and find it mindboggling. I work on brain imaging and unfortunately all of the analysis runs on Linux, and I do not understand computers well coming as I do from a medical background. So my question - There are various folders of patient MRI scans (folders called P1, P2, P3 etc) and within them are enclosed certain files that I am interested in (always called the same name in all folders, say image001). I would like a script that enables me to copy and move this image001 in all these individual folders to another folder altogether.

View 13 Replies View Related

General :: Find Files With Specific Extension And Move To A Directory?

Apr 18, 2011

I need little help. I want to find all files with extension "*.tar" "*.gz" and "*.zip" and move all those files into "/opt/old" directory. I've tried this command:

Quote:

find . -type f -name "*.tar" "*.gz" "*.zip" -print0 | xargs -0 -r mv /opt/test

It's not working, something wrong after "mv" i guess.

View 10 Replies View Related

General :: Moving Files From Folders And Subfolders To A Specific Folder?

Aug 21, 2010

I am using secure delete to remove files from a Debian Linux PC. However, secure delete does not remove folders. This has lead me to look at writing a script that would move files to a predetermined folder for deletion. My plan is as follows:I have a folder on my desktop called shredder where I move the contents of the waste bin to. The script needs to identify all files within the folders and sub folders, within the shredder folder, and move each file to the shredder folder and then delete the folder. At this point secure delete can be used with a command like shred -v -u *.*on the shredder folder.The problem I have is in creating the code to move files from the different folders and then deleting the folders. Note that the names of the files, folders and subfolders will not always be known

View 12 Replies View Related

General :: Find Folders With ONLY One Specific File In And Delete File And Folde

Oct 21, 2009

Many folders within a subdirectory some of which have lots of data in and some of which have only one specific file called produkt.fil inside.I need a command to find and delete those folders that contain ONLY the file produkt.fil - if other files exist (doesnt matter what they are) then they should be left alone. Note: produkt.fil exists in all of the folders always.

View 5 Replies View Related

Ubuntu :: Move All Files In All Folders Of A Folder Up One Level

Aug 20, 2010

I've got a folder called Foo. In foo, there are 20 folders called bar1, bar2, bar3,...,bar20. In each of those barXX folders there are 2 files. How can i move those 2 files up one level into Foo with one command?

View 9 Replies View Related

Ubuntu :: Move All The Files In All The Folders To One Central Folder?

Nov 20, 2010

I dual boot a computer from separate hard drives in Windows XP and Ubuntu 10.04. Here is the deal: On my windows drive I have a folder that is filled with folders inside folders packed full of files in all the folders. There is a 100% possibility that I have multiple copies of any file in multiple locations. Is there any nice command or program to move all the files in all the folders to one central folder and in any way get rid of the multiple copies? Also, how do I compare to files that may or may not have the same name, but otherwise be identical to see if they are identical?

View 9 Replies View Related

Programming :: Check Folder For Specific Files Than Move Script?

Nov 16, 2010

I have a script that checks a folder for zip files than moves them to a different folder. I want to check every 5 maybe 10 seconds and since cron is setup to run at least a 1 minute increment I'm not sure how to do that time check as probably a loop within the script. One other thing is once the time check is in the script how would a cron job be setup to run this script? Once the script is running cron doesn't need to run it again, is there a feature to check if it's running and if it's not then run it?

find /export/xxxshare -name "*.zip" -exec mv {} /export/store ;

View 3 Replies View Related

General :: BASH Script To Move Files/folders To Either The .Trash File Or To Another Direcotry?

Dec 2, 2010

I am looking for a script/advice or guidance on how to write a script so that when I use the 'del' command it removes/sends the files/folders to a I specify for example 'dustbin

View 13 Replies View Related

Ubuntu :: List All Files Of A Specific Extension (file Type)?

Jun 30, 2011

I want a list of all my mp3 files (or any other kind of file, actually) telling me HOW MANY OF THEM I have in my computer.I tried with both find and locate commands in terminal, but they don't tell me how many files I have.

View 2 Replies View Related

General :: Move File And Folder Date Stamps?

May 7, 2010

I wrote this little script and I need some help, I am trying to achieve following:Every day I receive new file in the /home/denis/MyData/ folder and I don't know what the file mane will be but I want to move any file that arrives there to the new location /media/DataBackup/Linux/backup/ (media/DataBackup/ is external 500GB USB drive)to automatically create new folder with the date and time stamp every day and then to move content of the /home/denis/MyData/ into the new folder with current date stamp. So every day there will be new folder and will contain files for that day only.My script is as follows:

cd /media/DataBackup/Linux/backup/
mkdir MyData_$(date +%Y%b%d_%HH%MM)
#this creates file MyData_current date and time

[code]...

View 3 Replies View Related

Ubuntu :: Kde 4.5 - Move A File Or Folder Into Another Folder, All The Icons Arrange Back To The Left Side

Sep 14, 2010

When I position icons on the desktop in specific places, then I choose to move a file or folder into another folder, all the icons arrange back to the left side. This happened in an earlier version of KDE 4.x, disappeared the next version, and reappeared. how to keep this from happening. It makes using the desktop a pain in the you know what.

View 2 Replies View Related

Debian :: Create Folder From Filename And Move File Into Folder

Feb 13, 2011

this is posable but am trying to do this "Create folder from a filename and move the file into the folder" i have 500000+ file's i need to do with is there a easy way?I really don't want to download them all make/move them with filemonkey just to re-upload them

View 2 Replies View Related

General :: File Permission - User Can Create Files/folders In The Shared Folder

May 4, 2011

Is possible to make a folder permission like below?

-User can create files/folders in the shared folder.

-But the files/folders they created, cannot be delete/change by em.
(only can be delete by root users)

-Each new files/folders created will auto owner to root only.

View 4 Replies View Related

General :: Shell Script To Search For Files Of Specific Extension And Delete Them All?

Mar 17, 2010

i want such a shell script or single line command to delete all the files with extension specified in script i have bash !! ex... delete all files of extension .obj

View 4 Replies View Related

Ubuntu :: Cannot Change Directory To A More Than Three Folder Tree Destination Folder From In Terminal?

Sep 18, 2010

I cannot change directory to a more than three folder tree destination folder from ~ in terminal. I've checked everything. No Typos or misspell. The destination folder was recognized by "ls" command but when I went to it, the terminal said, "no such file or directory."

View 7 Replies View Related

Ubuntu :: Move A File To A Nautilus Window With Folders In List View?

Nov 23, 2010

I don't know if this is a known issue, but when I want to copy/move a file to a folder containing lots of sub-folder displayed as list, I can't do a simple drag&drop, because there is no empty space to move this file. It will always go into one of the sub-folders. So obviously I have to go up one folder or to change view from list to Icon or Compact. Is it a known issue? Is there a solution? (Using GNOME nautilus 2.30.1)

View 9 Replies View Related

Programming :: Make A Folder For Each File In A Directory Then Move The File Into It

Nov 29, 2010

Initially I thought - use a for loop with ls in it:

Code:

However this causes lots of problems (folders have extensions, I have duplicate folders, the names with spaces create a folder for each element of the name).

The contents of the folder is basically movies (some with subtitles). Some of the names have things like (original) or CD1 CD2 in them.

View 15 Replies View Related

General :: Command Line - Move Folder Contents Into Parent Folder

Jun 11, 2010

I have a folderA that contains folderB that contains a lot of files. I would like to get rid of folderB, but not its contents. I want those contents to be inside of folderA. How can I accomplish this on the commandline?

View 2 Replies View Related

General :: List Folder Size And Number Of Files And Folders In Folder?

Nov 23, 2010

In Linux bash shell, for a given directory, how can I list:The create date for that directory The number of files in that directory The number of subdirectories in that directory.

View 3 Replies View Related

General :: Copy Folder Hierarchy / Recreate All Folders From One Directory Without Copying Over Contents Of Folder?

Jul 2, 2010

Is there a way to recreate all the folders from one directory to another without copying over the contents of the folder? I've been trying to do something like this,

Code:for i in `ls $X`; do mkdir $PATH/$i; doneUnfortunately $i is deliminated by whitespaces in the filenames and not the actual folders.

$X contains only other folders so I dont have to worry about regular files but any kind of more "advanced" solution would work.

View 1 Replies View Related

Ubuntu :: Source And Destination Folders Are Valid?

Apr 26, 2011

Which of these (if any) are correct?

cp -r /var/www/vhosts/niftyfiftyparty.com/httpdocs/sites/all/modules/*.* /var/www/vhosts/keylargodivecenter.com/httpdocs/sites/all/modules/*
in /var/www/vhosts/niftyfiftyparty.com/httpdocs/sites/all/modules/
cp -r *.* /var/www/vhosts/keylargodivecenter.com/httpdocs/sites/all/modules/*
in /var/www/vhosts/keylargodivecenter.com/httpdocs/sites/all/modules/
cp -r /var/www/vhosts/niftyfiftyparty.com/httpdocs/sites/all/modules/*.* *

Both the source and destination folders are valid. There are several folders in the niftyfiftyparty modules folder that I need in the other one.

View 2 Replies View Related

Ubuntu :: Move This Driver File To The Model Folder?

Apr 29, 2011

I am trying to post a driver in ..../cups/model folder but it says"access denied....could not write to ....cups/model.how do i move this driver file to the model folder

View 1 Replies View Related

General :: Copy Certain File Types Recursively While Maintaining File Structure On Destination?

Jun 14, 2011

I have just been bothered by a fairly small issue for some time now. I am trying to search (using find -name) for some .jpg files recursively. This is a Redhat environment with bash.

I get this job done though I need to copy ALL of them and put them in a separate folder BUT I also need to keep the order intact after copying.

For e.g - If I get a JPG file under /home/usr/new/1/ then the destination also needs to be /test/old/new/1/.

At the moment, I am simply putting all files under /test/old/ and I can't somehow get the later /new/1/ folder path created under /test/old/

I understand this could well be done using while OR if else loop, though if someone can just guide me with a hint, I would be really grateful.

I will complete the rest of the steps and was asking here since I am still not comfortable with the shell/bash scripts yet and planning to be really good at it over the next couple of months.

View 1 Replies View Related

General :: Copy File Whose Source Path Is Mentioned In File To Specified Destination

Jun 3, 2010

I had a situation in which the the path of the file to be copied is written in other file and I had to copy it using shell script..I can use cp $(cat /home/robert/location.txt) /media/sda1 on normal linux shell...But I am using buildroot script where $(cat /home/robert/location.txt) evaluate to nothing..is just blank..

View 1 Replies View Related

Ubuntu :: Deleted Folders During Grsyc Backup On The Destination Hd?

Mar 31, 2011

i took a back up using grsync and stupid me, the "delete on destination" was enabled.So, i lost some folders and files that i used to keep only on the receiver hd to keep my host clean

View 5 Replies View Related

Ubuntu :: Move/copy A File To A Shared Windows Folder?

Mar 23, 2010

I am able to view my windows network from my UBUNTU desktop after being prompted for a username and password to the windows network. No problem. But how can I accomplish this from the command prompt?

Here is my windows directory; smb://corpserver/d$/Data

And here is what I am trying to accomplish;

Code:
mv /var/lib/mysql/RSecuredData.csv smb://corpserver/d$/Data/Common/Secured%20R%20Reports/$(date +%Y%m%d)_RSecuredData.csv

Basically taking a csv file and moving it from mysql directory on my Ubuntu machine to a network folder on my windows server. (Windows Server 2003)

When I try that command from the command prompt I recieve;

Code:
mv: cannot move `/var/lib/mysql/RepoSecuredData.csv' to `smb://corpserver/d$/Data/Common/Secured%20Repo%20Reports/20100323_RepoSecuredData.csv': No such file or directory

View 9 Replies View Related

General :: Move All Files And Folders Into A New Directory?

Jan 25, 2011

Unix - In Linux, how do I move all files and folders into a new directory?

View 4 Replies View Related

General :: Copy All Files And Folders From Specific Date?

May 26, 2011

I wanna copy all folders and files created from 01.01.2011 until today to new placeie:cp -r /home/moviecar/public_html/wp-content/uploads/ /home/teaser/public_html/wp-content/uploads

View 4 Replies View Related

General :: Scripting To Move Thousands Of Files Into Folders

May 25, 2011

Our client has a website (Joomla 1.5 based) to promote participation in and report results of a 10k race for runners in Scandinavia...

The race is scheduled for late June and will be covered by at least 5 still photographers at various points along the race course.

There are to be about 5,000 runners, each entered under a shirt number like bib_1000 through bib_5999, and this means there will be a significant number of digital jpg files submitted by the photographers...

The client has in place some software which will "automagically" resize, watermark, and rename the individual files in the form:

And so on with a possibility of as many as 10 or 12 images in the aggregate with the same alpha-numeric "shirt number" at the beginning of the filename.

Our presentation software does a great job of handling thumbnail image generation and displaying a slideshow in a lightbox of all files within a given folder on the webserver.

And now finally the question...

Given a folder containing 25,000 or so *.jpg files, how can we write a script that:

1. parses the filenames to unique "shirt numbers"
2. makes folders with each "shirt number" as the foldername
3. moves the files from the root of the original folder into the appropriate "shirt number" folder.

Note that the order of my list above is not important, and if you know of a better way to organize the task we are fine with that.

View 12 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved