On 2008-03-12, Michael C. <mjchappell RemoveThis @verizon.net> wrote:
> On Wed, 12 Mar 2008 10:05:39 -0500,
> Ohmster <root RemoveThis @dev.nul.invalid> wrote:
[..]
>
> Not being able to delete is likly a problem with how it is mounted.
I think you are right. I did mount the shared directory as such:
[ohmster@ohmster test]$ sudo mount -t cifs -o
credentials=/home/ohmster/scripts/cifsauth,directio,uid=ohmster,gid=ohmster,rw,dir_mode=0755,file_mode=0644,iocharset=utf8
//missy/de /home/ohmster/test
This caused all files from the XP machine on the LAN to mount with all
files with these permissions:
(Please excuse the word wrap)
-rw-r--r-- 1 ohmster ohmster 140446 Mar 11 17:01
UlrikeEsszimmer092.jpg
-rw-r--r-- 1 ohmster ohmster 151222 Mar 11 17:01
UlrikeEsszimmer093.jpg
-rw-r--r-- 1 ohmster ohmster 189014 Mar 11 17:01
UlrikeEsszimmer094.jpg
-rw-r--r-- 1 ohmster ohmster 178665 Mar 11 17:01
UlrikeEsszimmer095.jpg
-rw-r--r-- 1 ohmster ohmster 186719 Mar 11 17:01
UlrikeEsszimmer096.jpg
Running fdupes seemed to work but the files did not get deleted.
[ohmster@ohmster test]$ fdupes -d .
[1] ./KatharinaTisch072.jpg
[2] ./KatharinaTisch072(1).jpg
Set 1 of 95, preserve files [1 - 2, all]: 1
[+] ./KatharinaTisch072.jpg
[-] ./KatharinaTisch072(1).jpg
[1] ./KatharinaTisch071.jpg
[2] ./KatharinaTisch071(1).jpg
Set 2 of 95, preserve files [1 - 2, all]:
[ohmster@ohmster test]$
(Control-c to kill the process)
[ohmster@ohmster test]$ ls -la KatharinaTisch072*
-rw-r--r-- 1 ohmster ohmster 162726 Mar 11 16:46
KatharinaTisch072(1).jpg
-rw-r--r-- 1 ohmster ohmster 162726 Mar 11 16:46 KatharinaTisch072.jpg
[ohmster@ohmster test]$
See? Not deleted. Trying to chmod 666 on all files made them all rw like
this:
[ohmster@ohmster test]$ chmod 666 *
[ohmster@ohmster test]$ ls -la KatharinaTisch072*
-rw-rw-rw- 1 ohmster ohmster 162726 Mar 11 16:46
KatharinaTisch072(1).jpg
-rw-rw-rw- 1 ohmster ohmster 162726 Mar 11 16:46 KatharinaTisch072.jpg
[ohmster@ohmster test]$
Still they don't delete. Even using sudo before the command won't work.
Your sample command would work as kick ass if I could get over this
mounted directory thing...
[ohmster@ohmster test]$ fdupes -f . |xargs rm
rm: cannot remove `./KatharinaTisch072(1).jpg': Permission denied
rm: cannot remove `./KatharinaTisch071(1).jpg': Permission denied
rm: cannot remove `./KatharinaTisch070(1).jpg': Permission denied
Let's see how they are mounted...
[ohmster@ohmster test]$ mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
//missy/de on /home/ohmster/test type cifs (rw,mand)
[ohmster@ohmster test]$
This would be the last entry, /home/ohmster/test.
> As for commandline:
>
> $ fdupes -f . |xargs rm
>
> This will delete dupes except the first of set in the current
> directory.
Man this command line would be bitching as hell if only it were not for
the mounted directory I think, it is just what I wanted. I could of
course just copy the files over, delete the dupes, then copy them back
again but I wanted to do an exercise in Linux. I wonder what I would
have to do in order to be able to delete files from this mount?
I will put some test files in there from Windows and see if I can delete them from
Linux. Hmmmm, not allowed.
-rw-rw-rw- 1 ohmster ohmster 178665 Mar 11 17:01
UlrikeEsszimmer095.jpg
-rw-rw-rw- 1 ohmster ohmster 186719 Mar 11 17:01
UlrikeEsszimmer096.jpg
-rw-r--r-- 1 ohmster ohmster 2705 Mar 12 17:53 zzzzfile1.txt
-rw-r--r-- 1 ohmster ohmster 2705 Mar 12 17:53 zzzzfile2.txt
[ohmster@ohmster test]$ rm *.txt
rm: cannot remove `zzzzfile1.txt': Permission denied
rm: cannot remove `zzzzfile2.txt': Permission denied
[ohmster@ohmster test]$
Try making them all wr now.
[ohmster@ohmster test]$ chmod 666 *
[ohmster@ohmster test]$ ls -la *.txt
-rw-rw-rw- 1 ohmster ohmster 2705 Mar 12 17:53 zzzzfile1.txt
-rw-rw-rw- 1 ohmster ohmster 2705 Mar 12 17:53 zzzzfile2.txt
[ohmster@ohmster test]$ rm *.txt
rm: cannot remove `zzzzfile1.txt': Permission denied
rm: cannot remove `zzzzfile2.txt': Permission denied
[ohmster@ohmster test]$
Still not allowed. What is up with that? I cannot even delete my own
files? My mount command is rw but says files to be 644. Maybe if I mount
them as 666? Let's try it.
[ohmster@ohmster ~]$ sudo mount -t cifs -o
credentials=/home/ohmster/scripts/cifsauth,directio,uid=ohmster,gid=ohmster,rw,dir_mode=0755,file_mode=0666,iocharset=utf8
//missy/de /home/ohmster/test
[ohmster@ohmster ~]$ mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
//missy/de on /home/ohmster/test type cifs (rw,mand)
[ohmster@ohmster ~]$
-rw-rw-rw- 1 ohmster ohmster 178665 Mar 11 17:01
UlrikeEsszimmer095.jpg
-rw-rw-rw- 1 ohmster ohmster 186719 Mar 11 17:01
UlrikeEsszimmer096.jpg
-rw-rw-rw- 1 ohmster ohmster 2705 Mar 12 17:53 zzzzfile1.txt
-rw-rw-rw- 1 ohmster ohmster 2705 Mar 12 17:53 zzzzfile2.txt
Yeah, they mounted as rw, try again now. No, still getting permission
denied. Hmmm, this is not working, maybe Windows XP is not allowing it
as a share, time to check share properties.
Yeah, that was it. I moved the folder in XP to J:\share and gave it a
share permission of full for user "Linux", then on the Security tab,
added user "Linux" and gave special full permissions on this directory,
it's contents, and all of it's subdirectories. I do have a user "Linux"
on the XP system as an administrator but hide him from the login welcome
screen with Tweak UI for XP Now I remounted it as 666 and have no
problems at all deleting files. Time to try xargs again.
[ohmster@ohmster test]$ fdupes -f . |xargs rm
[ohmster@ohmster test]$ man fdupes
[ohmster@ohmster test]$ fdupes .
[ohmster@ohmster test]$
Wow, boy oh boy did THAT ever work! Thank you Micheal, that is just what
I needed. Way cool brudder.
> You can also check out stripdups on my site. I haven't updated it
> since I discovered fdupes, but it does have the advantage that it will
> let you edit the list of files to be deleted in one step, it should
> also find matches between different file types. Make sure that
> nothing has been short circuited in the file unless that is your
> intent. It requires Imagemagick to be installed. If you use it READ
> it first, I've got to get ready for work.
>
> Michael C.
I tried reading the man page for xargs and cannot quite get the gist of
it. Can you, in just a few lines and in layman's terms, tell me just
what xargs does? Thank you.
--
~Ohmster | ohmster /a/t/ ohmster dot com
Put "messageforohmster" in message body
(That is MESSAGE BODY, not Subject!)
to pass my spam filter.