Ubuntu :: Commands For Batch Deleting Folders/files By Name/type?
May 18, 2011
I'm trying to clean up a few hundred thousand mp3 files and I'm dying to find a way to automate some of the mechanical tasks I keep doing. It seems like at least two of these tasks could be easily accomplished with something at the command line, but I don't have the chops/know-how to figure out how (and would really rather not trial and error with batch deleting files & folders...).
1) Delete all folders named "_MACOSX" (and all subfolders/files contained therein) -- Basically, I'd like to apply this command to a few hundred directories that may or may not contain a subfolder called "_MACOSX" that I'd really like to get rid of.
2) Delete all files named "*.m3u". -- Similar to the first, I want to automatically scan all directories and subdirectories in a given location for all instances of this file-type and delete them wherever they're found.
3) Move all files named *.txt", "*.doc", "*.pdf" to a specific location. -- Similar to the last, except instead of deleting, I'd like to just move them, so that if there is anything worth keeping, I can keep it.
View 3 Replies
ADVERTISEMENT
Oct 20, 2010
I have quite a few sound sample files totaling over 4 gigs in size with around 80 root folders and then around 34 sub folders. i have a total of 13 DVD's in the above format. how do i "change the date" on all files in one go is that possible?
View 3 Replies
View Related
Nov 19, 2010
I'm trying to understand the role of the at command. Does cron use at to run its jobs? Or is at, and batch for that matter, a separate cue that is only stored while the computer is on. As for anacron, anacron on runs once a day and is geared for a computer that is turned of frequently, as opposed to a server when it is on all the time. I've already man'ed these commands, and googled. I'm just trying to understand more how they work.
View 2 Replies
View Related
Feb 17, 2011
I'm looking to, all in the course of one batch file:
ssh into a remote computer execute commands (per the batch file) on the remote host.
What options do I need to add to the ssh invocation so that the batch file executes the lines following the ssh invocation over the connection?
e.g., with sftp it's simply adding a -b /dev/stdin and then << EOF at the end; how do I do this with SSH?
View 1 Replies
View Related
Nov 22, 2010
I need to write a windows batch file to run unix commands by logging onto a telnet unix server. For example , I might want the batch file to log onto the unix sever, run the ls command, collect the output in a file and ftp it back to my windows desktop
View 8 Replies
View Related
Nov 13, 2010
I'm pretty new to Ubuntu and it might not be possible to do what I want to do here. First I'll explain the situation. Throught trying to tidy up my mp3 collection usign various pieces of software I now have a folder structure that I want (My MusicArtistalbum rack), However, in the process, I have been left with lots of other folders - these have had the mp3's removed but they contain other files (artwork, playlists, .nfo files - that kind of thing).
What I'm looking for is either a premade solution or help with a script to do the following : Check all folders in my music folder, if the folder doesn't contain any mp3's then check the subfolders, if none of them contain mp3's then delete the main folder (regardless of what otehr files are within it).
It seems like I should be able to do this - but not sure how. Incidentally, I have backed up my music folder to an external disk - so I can't do any lasting damage
View 2 Replies
View Related
Oct 12, 2010
I have the following script to delete some folders from a text file:
Code:
#!/bin/bash
current_dir=$(pwd)
for folder in `cat dir_list.txt`; do
[Code]....
This does not work. If I delete them manually it works fine, but in the script it just finishes quickly. When the variables are echoed they display the values correctly.
View 4 Replies
View Related
Jul 7, 2011
I accidentally created a folder in my /home directory and its ticking me off because i cant delete it and im anal about my organization on the computer and having this extra empty folder.
View 5 Replies
View Related
Aug 11, 2010
I installed avast anti-virus on my 10.04 T42p thinkpad. It immediately slowed to a walk! and the registration number did not work and caused an error message. I tried to reinstall the program with no improvement/same result. then tried to remove the program from the machine with dpkg. Seemed to get rid of it but some of the folders it created are still there and won't let me trash them. The machine still seems slow, so how do I get rid of all traces of avast?
View 3 Replies
View Related
Apr 21, 2011
So I have a share hosting account with 60 sites all running wordpress.
There is a plugin I want to delete from all 60 wordpress sites.
The plugin is in the same path in all 60 sites.
mysite.com/wp-content/plugins/carter Is there a way I can search the entire home directory with filezilla or another ftp and delete every folder with that name in every site or I have to do it the tedious 1by1 sucky way?
View 4 Replies
View Related
Oct 22, 2010
I am new to Linux, have used KDE/SLAX before but am now attempting to use linux on my old computer to accomplish these objectives:
1) Run an FTP so I (& my mates) can access files anywhere wit ease(no dramas).
2) Enable sharing of my drives so I can put files from Laptop into this computer
Now I have successfully Installed Ubuntu Server (Finallllly) but then messed up cuz I installed the Gnome GUI and now cant find any place where I can type any sudo commands. vsftpd should work for me right?
View 3 Replies
View Related
Oct 19, 2010
I recently installed JDK 6 runtime using apt-get install in terminal. I downloaded a .jar file and attempted to run it but I got an error telling me it has blocked the file for some reason.Another thing was, how can I run batch files? I know ubuntu doesn't come with something like MS DOS but is there anything similar that I can run batch files with?
View 3 Replies
View Related
May 19, 2010
ssh to a machine on my network open up a terminal (gnome, xterm, whatever) and have it visible on that machines display be able to type and execute commands in that window, from my computer. i have kind of achieved this. on machine A, i ssh to machine B. on machine B, i open up a terminal and execute screen, C-a :multiuser on. on machine A, i execute screen -x and connect to the term on B. everything i type from A or B can be seen. i just want to be able to set this up without having to physically be at machine B. does that make sense?
View 7 Replies
View Related
Nov 27, 2010
Does deleting files using the Ubuntu One web interface delete the files stored on my computer?
View 1 Replies
View Related
Nov 9, 2010
Is it possible?I am mainly looking for A shell script or program that can convert a Batch (.BAT) file into a Windows executable (.EXE), or
A program that can be run from MS-DOS that can turn a batch into an exe.
View 3 Replies
View Related
Aug 7, 2010
I am ssh'ing into a remote server and then su'ing to root.The problem is that sometimes, I have not paid enough attention to the console message, and I have accidentally typed in the root password at the command prompt (when for example, I had failed to provide the root password correctly the first time - so su prompt went away).
I remember reading somewhere that a history of commands typed at the console is kept somewhere.I have 3 sub questions
Where (which folder) is the file stored?
Can I edit that file and remove the root password from it?
Being the paranoid person that I am, I wonder if there is a more secure way of logging into my server - other than ssh (or am I being TOO paranoid?)
My server is running a headless Ubuntu 10.0.4
View 1 Replies
View Related
Sep 14, 2011
Is there any way to list just the folders in a directory using bash commands? ( as the ls command lists all the files and folders )
View 3 Replies
View Related
Apr 16, 2011
So I have a php script that is setup to stream flash video (.flv) and I absolutely love having it. The problem is that any files I want to stream have to be in .flv format for it to work properly as .avi and others obviously don't stream well. Up until now, I've used FFMpeg to change the format from .avi to .flv, however the process takes a lot of time if you have a lot of videos, added to that you have to do one file at a time definitely makes it a pain.Does anyone know of a bash script that can take all the files (i.e. avi, .wmv, .mkv, .mpeg4) in one folder and automatically convert it to .flv? Then possibly delete the old files? Low resolution is fine, so long as it at least viewable. Does anyone have a script or know of a program that can do this (I run Ubuntu 10.04). I think FFMpeg has the best chance of doing this, but I don't know the syntax to actually do so.
I've searched the internet, and while I have found a few scripts, they didn't work for me (still looking into two scripts I found.I am currently messing with them to see if I can get them to work).It would be immensely helpful if someone knew of a way to do this.I also forget to mention that I have used Winff, but I was looking more for a bash script to do this so that I can set a cron job to convert them every hour or so.
View 4 Replies
View Related
Jan 12, 2010
I need commands which five me the following details abt all the file systems mounted the linux box
type
mount pt
file system id
View 4 Replies
View Related
Jul 16, 2011
I have recently been tasked to extract the subtitles from a lot of mkv files. Hundreds of them, maybe even more than a thousand. To do this, I modified a script I found online:
#!/bin/bash
IFS="|"
if test -z $1; then
[Code].....
So in the above example the subtitle is actually in track number one and my script would be borked for that particular file. Is there a way to integrate mkvinfo into the script and parse it to see what track should be extracted? Like, read it line-by-line and change the value of some #TRACKNO variable everytime a string like "| + Track number:" appears, and stop when a string like "| + Track type: subtitles" appears? Maybe even skip doing anything if there aren't any subtitles.
PS: I actually prefer SRT subtitles to ***. If there was some command line tool I could use to convert the resulting *** file to SRT I would be much obliged.
View 2 Replies
View Related
Aug 27, 2010
when i scan some documents they are saved as .PNM files. what I would like is JPGs.
does anybody know any good ways of batch converting pnm files to jpeg files.
View 9 Replies
View Related
May 29, 2010
I'm completely new to scripting and I'm trying to figure out how to write a script that will get a list of all the files in a directorywn through any subdirectories.When I have the list I want to o each file in VI and change the fileformat. So far all I have been able to figure out is that VI can do the batch processing and that "ls -R" gets me the recursive file list. I'm still pretty clueless on how to do the batch process with the VI editor. I think I'm supposed to use the Ex mode but I don't know how to get the list of arguments from the filelist into the editor so they can be processed. If it matters the files were all written in a Windows editor and have gotten the MS carriage returns so I want to do a :set ff=unix command on all the files without having to go into each file manually, there are over 300 files that need updated.
View 3 Replies
View Related
Jun 26, 2011
My problem is that I have a folder that had been "lost", aning that it isn't seen by either Windows or Ubuntu. I was able to recover the data from the folder by using a program off the Ultimate Boot CD for Windows called Handy Recovery, but I don't know how to get rid of the folder and files I had backed up. "What's the problem if it's gone?" you might ask? Because the hard drive space is being taken up with the files. I can't access these files, yet they are still there taking up space.What programs are available on Ubuntu that will get rid of these files (and these files *only*) without wiping out the partition?
View 9 Replies
View Related
Apr 15, 2010
I scanned hundreds of pages in gray scale and would like to batch process them to B&W. You can do this using the gimp GUI. what it does is get rid of all the gray shading from reflections off the paper when scanned. So you get crisp white backgrounds with black text and diagrams. I would like to simply do this to the entire group directory at one time as it would be quite a lot of effort to open them and do them one by one.
View 3 Replies
View Related
May 8, 2010
a movie is encoded with AC3 in 6 channel audio, what I get out is all of the sounds except for voices, which in 5.1 would be sent to the center channel. What I usually do is fire up avidemux and convert the audio to mp3 stereo, as converting to a 5.1 format usually ends up with a very odd sound (like running everything through an echo chamber). What I'd like to do is run a script to batch-convert these files from AC3 to MP3. The video format may vary, but they are usually XVID. I am comfortable at the command line, but I am not well-versed in audio/video tool terms. I don't need anything extravagant, I just want something that works. Heck, even if it is done one at a time, having a shell script that I can use to simply type:
tool.sh inputfile.avi outputfile.avi
View 4 Replies
View Related
May 26, 2010
I just did something stupid... I wanted to remove a numeric prefix from a bunch of files in a folder (EXT4 filesystem), and I ran the following Python commands to rename the files:
Code:
import os
currentdir = os.getcwd()
[code]...
View 7 Replies
View Related
Dec 11, 2010
I run a script which generated about 10k files in a directory. I just discovered that there is a bug in the script which causes some filenames to have a carriage return (presumably a '' character).
I want to run a sed command to remove the carriage return from the filenames.
Anyone knows which params to pass to sed to clean up the filenames in the manner described?
I am running on Linux (Ubuntu)
The character causing the filename to 'break up' accross multiple lines appear to be a CR (carriage return) instead of ' '. The filename is being diaplayed in thetitle of a text editor with %0D in the positions of where the file name breaks up. So I need to remove the CR chars from my filenames.
View 1 Replies
View Related
Oct 9, 2010
I have a lot of pdf files and I want to convert them to a lower quality for the web. I tried to use the following command (using ghostscript): Code: gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf Is there a way to make a batch to do this for all pdf-s in a folder?
View 4 Replies
View Related
Jun 18, 2010
I want to do something like svn add dir1 dir2; svn ci dir1 dir2 but have it be only 1 revision. Is there a way to do this? Is this the correct way to add new folders (with contents) to the repository? We are restructuring the trunk, so I cleared it out and plan on putting these directories with their contents in it.
View 1 Replies
View Related
Dec 1, 2010
possible to rename a list of files in batch in order to maintain the last part of them, then purge a central section and then again maintain the extension?I.E.:
Code:
file01.qwertyuiop.txt
file02.asdfghjklmnbvzxcqwertyuiop.txt
[code]....
View 7 Replies
View Related