Help deleting unwanted files

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read this

Help deleting unwanted files

Postby deepfatfriar on Sat Feb 23, 2008 9:23 am

First of all a thank you to everyone involved with Linux Mint, it is a truely great distro (and I've tried a few!)

I am trying to clean up a music collection that was once used by windows, it contains a whole load of "desktop.ini", "Thumbs.db" and randomly named JPG files (some of which I think are corrupt). The result of listng an individual folder is as follows

Code: Select all
user@host:/mnt/files/shared/music/Zorg/Paris Lounge 3 - CD2$ ls -l
total 5204
-rwxrwx--- 1 david users 5296632 2007-04-07 17:40 01 Closer To The Peace.mp3
-rwxrwx--- 1 david users    1303 2007-02-25 13:14 AlbumArt_{788743ED-F95D-4D00-9340-65245D3550FD}_Large.jpg
-rwxrwx--- 1 david users     727 2007-02-25 13:14 AlbumArt_{788743ED-F95D-4D00-9340-65245D3550FD}_Small.jpg
-rwxrwx--- 1 david users     727 2007-02-25 13:14 AlbumArtSmall.jpg
-rwxrwx--- 1 david users    1303 2007-02-25 13:14 Folder.jpg
user@host:/mnt/files/shared/music/Zorg/Paris Lounge 3 - CD2$


First question, do the file permissions look OK?

Second question why is it that when I run the following it doesn't show me any of the jpeg files that I know exist? (I'd be happy to read and learn topics if I only knew what to read up on!)

Code: Select all
user@host:/mnt/files/shared/music$ ls -R *.jpg
ls: *.jpg: No such file or directory
user@host:/mnt/files/shared/music$


Especially when running the following command does show all the JPEGS!?!?!?

Code: Select all
user@host:/mnt/files/shared/music$ ls -R

**** SNIP ****

./Zimpala:
Paris Lounge 3 - CD2

./Zimpala/Paris Lounge 3 - CD2:
08 The Breeze Is Black (Mondae Mode.mp3                    AlbumArtSmall.jpg
AlbumArt_{788743ED-F95D-4D00-9340-65245D3550FD}_Large.jpg  Folder.jpg
AlbumArt_{788743ED-F95D-4D00-9340-65245D3550FD}_Small.jpg

./Zorg:
Paris Lounge 3 - CD2

./Zorg/Paris Lounge 3 - CD2:
01 Closer To The Peace.mp3                                 AlbumArtSmall.jpg
AlbumArt_{788743ED-F95D-4D00-9340-65245D3550FD}_Large.jpg  Folder.jpg
AlbumArt_{788743ED-F95D-4D00-9340-65245D3550FD}_Small.jpg
user@host:/mnt/files/shared/music$


Third question, if I am using the wrong approach above then is there a command to delete all the .ini files from a directory structure or am I missing something?

Many thanks in advance for your help!

Dave
deepfatfriar
Level 1
Level 1
 
Posts: 7
Joined: Thu Feb 21, 2008 11:52 am

Linux Mint is funded by ads and donations.
 

Re: Help deleting unwanted files

Postby muskratmx on Sat Feb 23, 2008 1:42 pm

First question, do the file permissions look OK?


No; photos shouldn't have execute (X) permissions.

user@host:/mnt/files/shared/music$ ls -R *.jpg


When you use the -R, that's for recursive, and it begins looking in the folder you state "*.jpg" which isn't there hince the error. It should read, "ls -R /mnt/files/shared/music/*.jpg" or I believe the "./" is for the current directory such as "ls -R ./*.jpg"

Third question, if I am using the wrong approach above then is there a command to delete all the .ini files from a directory structure or am I missing something?


I am reluctant to list and rm commands for other people, because if I do a fat fingered typo, and you do it also, "POP THERE GOES THE WEASEL". So please be carefull with wildcards and rm.

You should use safety when using rm, two things. One; run you ls command with the wild cards frist, until the return is exactly like you want, returning only the files you wish to delete, then at the command promt, click the up arrow, which returns the last issued command, change the ls to rm and you should be safe. Two use rm with the -i option, this is interactive requiring you to ether enter y or n for each file before it's deleted.

Happy wildcards :D
User avatar
muskratmx
Level 4
Level 4
 
Posts: 226
Joined: Sun Dec 09, 2007 1:30 pm
Location: TX/MX Gulf Coast

Re: Help deleting unwanted files

Postby deepfatfriar on Sat Feb 23, 2008 6:09 pm

Hi Steve,
Thanks for your help :D unfortunately I'm still having the same problem:

Code: Select all
user@host:/mnt/files/shared/music$ ls -R /mnt/files/shared/music/*.jpg


Is trying to find a folder or folders named "*.jpg" within the music folder and then recursive folders within the music folder....

Any more ideas? Anyone?

Cheers,

Dave
deepfatfriar
Level 1
Level 1
 
Posts: 7
Joined: Thu Feb 21, 2008 11:52 am

Re: Help deleting unwanted files

Postby saman on Sat Feb 23, 2008 6:27 pm

You need to use the find command.

To simply list the files, first of all "cd" to the music direcory and then run,
Code: Select all
find | grep -i .jpg


If you are sure that you want to delete all the files that were listed, you can run:

Code: Select all
find | grep -i .jpg | xargs rm -vf
saman
Level 1
Level 1
 
Posts: 1
Joined: Sat Feb 23, 2008 6:19 pm

Re: Help deleting unwanted files

Postby muskratmx on Sat Feb 23, 2008 7:44 pm

It should work here's my ls retruns, frist I just run ls
Code: Select all
steve@steve-laptop:~$ ls
44218-linuxdistrotimeline-72.png  file:                   Pictures
amsn_received                     hosts-adblocker.txt     Podcasts
Avast-Antivirus                   Howtos                  Projects
CIS-receipt.txt.odt               linux-virsus-windows    rute.html.tar.bz2
Daryna_User_Guide.pdf             machine-counter.cgi     steve
Desktop                           menu.lst                Templates
Documents                         Music                   Videos
Downloads                         nautilus-debug-log.txt  wireless-T41
drivers-daily-report.odt          Network
echostore                         Oddparts
steve@steve-laptop:~$ ls *.pdf
Daryna_User_Guide.pdf
steve@steve-laptop:~$ ls -R ~/*.pdf
/home/steve/Daryna_User_Guide.pdf
steve@steve-laptop:~$ ls -R ./*.pdf
./Daryna_User_Guide.pdf
steve@steve-laptop:~$

Then I run 'ls *.pdf' then 'ls -R ~/*.pdf' then ls -R ./*.pdf', since I have only one pdf in my home directory it only shows one.

OK I'm sorry, I missed one little jot, that was why I didn't want to list any rm commands, just because. look at this, I run 'ls -R /home/Data/*/*.pdf'
Code: Select all
steve@steve-laptop:~$ ls /home/Data/*.pdf
ls: /home/Data/*.pdf: No such file or directory
steve@steve-laptop:~$ ls -R /home/Data/*.pdf
ls: /home/Data/*.pdf: No such file or directory
steve@steve-laptop:~$ ls -R /home/Data/*/*.pdf
/home/Data/books/IBMs-migrate-to-linux.pdf
/home/Data/Linux_Info_Documents/emacs-refcard-letter.pdf
/home/Data/Linux_Info_Documents/grub.pdf
/home/Data/Linux_Info_Documents/JoeCommandReference.pdf
/home/Data/Linux_Info_Documents/QuickRefCard.pdf
/home/Data/Linux_Info_Documents/Sarge-install.en.pdf
/home/Data/misc-PDFs/fpu_babysteps.pdf
/home/Data/misc-PDFs/Metric Table.pdf
steve@steve-laptop:~$


I missed the /*/*.pdf.
User avatar
muskratmx
Level 4
Level 4
 
Posts: 226
Joined: Sun Dec 09, 2007 1:30 pm
Location: TX/MX Gulf Coast

Re: Help deleting unwanted files

Postby deepfatfriar on Sat Feb 23, 2008 8:06 pm

I hate admitting defeat but none of those approaches were doing quite what I was after - thanks though :D

I ended up using a samba share and using DOS instead.

Thanks all I guess I just can't shake my Windows 3.11 roots!

Cheers

Dave
deepfatfriar
Level 1
Level 1
 
Posts: 7
Joined: Thu Feb 21, 2008 11:52 am

Re: Help deleting unwanted files

Postby jbaerbock on Sat Feb 23, 2008 8:10 pm

I would simply use the filemanager and delete them. If the permissions do not allow you to just type "gksu nautilus" in the run dialog box and you will be using nautilus as root.
jbaerbock
Level 4
Level 4
 
Posts: 309
Joined: Tue Jun 05, 2007 11:31 pm
Location: St. Peter, MN

Re: Help deleting unwanted files

Postby muskratmx on Sat Feb 23, 2008 9:14 pm

deepfatfriar wrote:I ended up using a samba share and using DOS instead.

Thanks all I guess I just can't shake my Windows 3.11 roots!


It takes a little getting used to, the wild cards is where all the power in the CL is. But it's also the hardest to master. I'm by no means a master, but getting better every day.

I guess I should consider myself blessed I never was that great in Dos, so I didn't have to relearn, just learn.
User avatar
muskratmx
Level 4
Level 4
 
Posts: 226
Joined: Sun Dec 09, 2007 1:30 pm
Location: TX/MX Gulf Coast

Linux Mint is funded by ads and donations.
 

Return to Newbie Questions

Who is online

Users browsing this forum: Bing [Bot], Mute Ant and 35 guests