Hi all... I need to compare two dir and delete files in the second dir that have the same name as in the first. How could I do this? Thanks, JIM -- Jim Hatridge Linux User #88484 ------------------------------------------------------ WartHog Bulletin Info about new German Stamps http://www.fuzzybunnymilitia.org/~hatridge/bulletin/index.php Viel Feind -- Viel Ehr' Anti-US Propaganda stamp collection http://www.fuzzybunnymilitia.org/~hatridge/collection/index.php
On Tuesday 07 March 2006 10:18, James Hatridge wrote:
Hi all...
I need to compare two dir and delete files in the second dir that have the same name as in the first. How could I do this?
Option 1: Open two shells side by side on your desktop and navigate to the respective directories independently in each one. If the files are too numerous and this isn't practical, try option 2: Option 2: Instead of using typed commands in the shell, run "mc" instead. By default, it opens in 'split' view... the left and right panes navigate independently of each, which makes directory structures and content comparisons very easy. If needed, for permissions, you can "su -" before launching mc. Your mouse will work, too (at least it does on mine. YMMV.) If you want something prettier, go to option 3: Option 3: From your desktop, you can use two Konqueror windows and navigate to each directory separately. For root privileges: open your main menu, scroll up to "System," scroll down the flyout menu to "File Manager" and select "File Manager - Super User Mode" from the second flyout menu. If that's too much work, go to option 4: Option 4 (my GUI favorite): Install Krusader with YaST or apt-get or smart or whatever your preferred package manager is (or just go straight to the site and download the rpm: http://ftp.gwdg.de/pub/linux/misc/suser-guru/rpm/packages/Utilities/krusader...) I don't know why Krusader isn't part of the normal distribution, but it's got some great shortcuts built into it. It does "superuser" mode when needed, too. And please be certain you know what you're deleting before you actually start deleting it! ;-) regards, Carl
On Tuesday 07 March 2006 10:18, James Hatridge wrote:
Hi all...
I need to compare two dir and delete files in the second dir that have the same name as in the first. How could I do this?
Try: cd <<directory containing files you might delete>> for i in * do if [ -f <<path to other directory>>/${i} ] then rm $i fi done Try this first without the actual "rm" statement, replace it with something like "echo ${i} should be deleted" That way you can tell what it would do and whether you like the results. Cheers, Simon "You can tell whether a man is clever by his answers. You can tell whether a man is wise by his questions." Naguib Mahfouz __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Tuesday 2006-03-07 at 12:44 -0500, Carl Hartung wrote:
Option 2:
Instead of using typed commands in the shell, run "mc" instead. By default, it opens in 'split' view... the left and right panes navigate independently of each, which makes directory structures and content comparisons very easy.
And then, use "Command/Compare directories C-x d" ;-)
I don't know why Krusader isn't part of the normal distribution, but it's got some great shortcuts built into it. It does "superuser" mode when needed, too.
But it is... ./DVD1/suse/i586/krusader-1.51-4.i586.rpm - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFEDc42tTMYHG2NR9URAqCTAKCBYQZRagSLX3M+53U23flfA0eYfACfYCit i0ZYnz9S5S6x9xaxTbXKp2E= =Y4wa -----END PGP SIGNATURE-----
On Tuesday 07 March 2006 13:17, Carlos E. R. wrote:
And then, use "Command/Compare directories C-x d"
;-)
Doh! You pointed this out to me already! Time for a post-it note...
./DVD1/suse/i586/krusader-1.51-4.i586.rpm
Well, I haven't got around to reinstalling 10.0 yet. I've got some hardware
upgrades coming up soon, so that'll change.
I don't think it was packaged with 9.3 (could be wrong.) Aside: note the build
date!:
pin 0.30 - package info for krusader
------------------------------------------------------------------
*** rpm info
------------------------------------------------------------------
Name : krusader Relocations: (not relocatable)
Version : 1.70.0_1.0 Vendor: (none)
Release : 1.guru.suse93 Build Date: Fri 17 Feb 2006
09:59:08
PM EST
Install date: Fri 24 Feb 2006 09:09:44 AM EST Build Host: hera.lan
Group : Productivity/File utilities Source RPM:
krusader-1.70.0_1.0-1.gu
ru.suse93.src.rpm
Size : 5993471 License: GPL
Signature : DSA/SHA1, Fri 17 Feb 2006 09:59:21 PM EST, Key ID
af734c5a58857177
Packager : Pascal Bleser
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Tuesday 2006-03-07 at 13:27 -0500, Carl Hartung wrote:
./DVD1/suse/i586/krusader-1.51-4.i586.rpm
Well, I haven't got around to reinstalling 10.0 yet. I've got some hardware upgrades coming up soon, so that'll change.
I don't think it was packaged with 9.3 (could be wrong.)
The above was for 9.3, I don't use 10.0. I have to confess that I didn't have krusader installed, I'm testing it now. [...] It is a kde app... Seems similar to mc... and I'm very much used to mc ;-) I'll try using it when I nee graphical view of something, I think. I like text mode for somethings.
Aside: note the build date!:
Release : 1.guru.suse93 Build Date: Fri 17 Feb 2006 > 09:59:08 Install date: Fri 24 Feb 2006 09:09:44 AM EST Build Host: hera.lan
Ha, you go for the latest :-) - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFEDdiAtTMYHG2NR9URAsLZAJwO2Ic6Mt8RZE5cRavztLI/TFioYwCfckV5 yn+ZJom/emCUY5Jz/eq8JGA= =z2jH -----END PGP SIGNATURE-----
On Tuesday 07 March 2006 11:44 am, Carl Hartung wrote:
On Tuesday 07 March 2006 10:18, James Hatridge wrote:
Hi all...
I need to compare two dir and delete files in the second dir that have the same name as in the first. How could I do this? <snip> Option 3:
From your desktop, you can use two Konqueror windows and navigate to each directory separately. For root privileges: open your main menu, scroll up to "System," scroll down the flyout menu to "File Manager" and select "File Manager - Super User Mode" from the second flyout menu. If that's too much work, go to option 4:
Or use Konqueror's Midnight Commander profile. From the main menu choose Settings, Load View Profile, Midnight Commander. The two panes are linked by default currently so go to the View menu option and uncheck the Link View option. Stan
Il giorno mar, 07/03/2006 alle 16.16 -0600, S Glasoe ha scritto:
Or use Konqueror's Midnight Commander profile. From the main menu choose Settings, Load View Profile, Midnight Commander. The two panes are linked by default currently so go to the View menu option and uncheck the Link View option.
just to make a notice on the twin panel file management there are (at least) two packeges doing the same on Gnome: - TuXcommander: http://tuxcmd.sourceforge.net/ - Gnome-Commander: http://www.nongnu.org/gcmd/ unfortunately they are (still) not part of Gnome main workspace and are not available (afaik) in suse compatible rpm's format [the second was in Pascal's pool at SuSE 9.0 time]. Between the 2 i've like better tuxcommander, anyway. Cheers, -n -- nicola .:kOoLiNuS:. losito http://koolinus.wordpress.com http://www.koolinus.net [ITA] powered by SUSE Linux 10.0
On Tuesday 07 March 2006 08:18, James Hatridge wrote:
Hi all...
I need to compare two dir and delete files in the second dir that have the same name as in the first. How could I do this?
Open konqueror, then do ctrl+shift+L. Now you have two panes to work with. -- Jim Barnes -- Certainly the game is rigged. Don't let that stop you; if you don't bet, you can't win. -Lazarus Long -- Linux 2.6.12-10-386
participants (7)
-
Carl Hartung
-
Carlos E. R.
-
James Hatridge
-
jim barnes
-
Losito Nicola
-
S Glasoe
-
Simon Roberts