Tag Info

New answers tagged

0

I had similar issues. Do you have Gnome, KDE or some kind of Xwindow DM?. If you do open your file broser and remove the file from there. It should work. I would like to see a solution from the command line, but in my case and after losing a lot of time trying to figure out how to remove it from the command line I found that it was as simple as removing ...


1

Recreating the directory seems a pretty clean way to do it. find /data1 -name MyTargetDir -type d -exec rm -rv {} \; -exec mkdir {} \; You could instead use a subshell in the exec to run a rm -rf * (or similar) from within the directory. But that just seems more trouble than the above. You have the side effect of cleaning up the directory size if that ...


0

No doubt there are nicer ways of doing it, but this should work: for MyTargetDir in `find /data1 -name MyTargetDir -type d -depth` do if [ $MyTargetDir != "" ]; then rm -rfvi $MyTargetDir/* fi done The if statement is required in case you never find the directory that you are looking for in which case the rm command would destroy your root file ...


-1

Or you could try this command without the r option in rm. so it don't will be able to remove directories.


0

rm -rf MyTargetDir && mkdir MyTargetDir It should do what you are trying to do.


3

The following excerpt from this essay potentially explains why that directory refuses to be deleted: NFSv4 requires that all filenames be exchanged using UTF-8 over the wire. The NFSv4 specification, RFC 3530, says that filenames should be UTF-8 encoded in section 1.4.3: “In a slight departure, file and directory names are encoded with UTF-8 to deal with ...


0

Have you tried to get the inode of that file with stat: stat mike* That should give you the inode number (and other data), and then you could try to delete it.


0

Have you tried using rm -rf ./mikeaâcnt or rm -rf "./mikeaâcnt" or an absolute path? Also instead of rm, try rmdir ./mikeaâcnt.


0

After getting the correct hex code of file / folder name (using whatever method one sees fit, I may choose ls --show-control-chars | xxd), some special construct should be used to address such characters when running under bash: rmdir $'mikea\xc3\xa2\xc2\x81\xc2\x84cnt' Otherwise backslashes are treated as vanilla backslash.


11

One way to delete files/direcories like this is by their inode-reference. To find the inodes for elements in current dir: ls -i 14813568 mikeaâcnt To delete this: find . -inum 14813568 -delete


6

You should not use non-ASCII characters in the command line since as you could see, for some reason, they won't necessarily correspond to the filename (Unicode has various ways for expressing accented letters). Something like: rm -rf mike* should work since the filename is directly generated by the shell. But make sure there's only one match (do an echo ...


3

I have personally tested using find's -exec directive: $ mkdir -p mikeaâcnt $ ls mikeaâcnt $ find -maxdepth 1 -type d -empty -exec rm -rf {} + $ ls $ The folder was correctly created and correctly removed. As pointed out by @Igeorget, there's an even simpler method if you have GNU find: $ find -maxdepth 1 -type d -empty -delete I also tested this ...


0

Linux Walkthrough of creating a file with dashes and spaces, then removing it. BE CAREFUL! Don't accidentally run a rm -rf / or similar cascade delete command. If your file you are trying to remove includes asterisks or slashes, do not accidentally pump a . or /* or * or some other wildcard which could cascade delete your operating system. Create a ...


2

Filter When Recursing with Fdupes If you have more than one duplicate then you might end up with something like: srv/foo srv/a/b/foo watchfolder/foo watchfolder/c/foo watchfolder/d/foo In such a case, you need to feed the list of duplicates into a filter or shell script to apply some smarter rules, unless you only want to ...


1

fdupes will keep the first file, as in the file with the earliest timestamp. It is a bit misleading in what it states in the help. $ ll foo/ bar/ bar/: total 12 -rw-rw-r--. 1 BriGuy BriGuy 2 Jul 23 16:10 a -rw-rw-r--. 1 BriGuy BriGuy 102 Jul 23 16:22 b -rw-rw-r--. 1 BriGuy BriGuy 610 Jul 23 16:23 c foo/: total 12 -rw-rw-r--. 1 BriGuy BriGuy 2 Jul 23 ...


0

Use secure delete instead. sudo apt-get install secure-delete srm -r pathname Done. Secure delete is a lot more paranoid than shred, using 38 passes instead 3. To do a fast single pass, use srm -rfll pathname fll gets you a less random random data generator, and only a single pass.


2

ls -al is great for checking to see if there are any hidden directories. Barring that rm -rf removes recursively and forces the removal, keep in mind that rm -rf \ will delete everything. Depending on distro this may throw an error, or demo your entire file system. Ubuntu normally doesn't let you do an rm to your root filesystem.


3

Based on the output you're showing in your question the directory gamesForAdmin is not empty, so rmdir cannot remove this directory. To remove it you'll need to use rm -fr instead. Try this: sudo rm -rf gamesForAdmin which should fix you right up.


5

Your folder can have some hidden files (ls doesn't show dot files by default, i.e. files whose name begins with . are hidden). Run: ls -la gamesForAdmin to check if there is any hidden files in it. Updated According to your result ls -la, your directory is not empty, so rmdir can not remove it, rmdir only work with empty directory. To remove it, you ...


0

After reading and researching many answers, I found (imho) im3r3k's answer above to be the most thorough. I would only add to it that since shred does not remove directories I appended rm -rvf $1 to the shell script (where $1 is the /path/to/your/file passed in from the {} expansion in the find... -exec)


0

find /path/folder -type d -ctime +7 | xargs rm -rf ctime +7 only consider the ones with modification time older than 7 days


0

What you want is not possible IMHO with a single find run unless you know that all the directories to be skipped are in the first directory level. first step In the first run delete all the files (or rather: non-directories): find . \( -type d \ \( -name '*log*' -o -name 'world*' -o -name 'crash-reports' -o -name 'banned-ips*' \) \ -prune \) -o \( ...


1

-type f will only find files, not directories. -maxdepth 0 will only ever find the directory you're searching in (.). You'll have to find the files you actually want to pass to rm. The standard way to do this is to exclude directories and all their contents like this (untested!): find . -mindepth 1 \( -name '*log*' -o -name 'crash-reports' -o -name ...



Top 50 recent answers are included