General :: How To Delete All Files In Directory Without Deleting?
Feb 9, 2010
I know that rm -i will prompt wether you want to delete each file.But rm -i -r will prompt for each file in each subdirectory recursively. How to make it prompt just for the directory itself, and then delete its contents without asking?How to delete all the files in a directory without deleting . and ..?How to recursively delete all tilde files in a directory?How to GUI file managers delete files to Trash? Where is this "Trash" located? Can you delete to trash in the command line?
View 14 Replies
ADVERTISEMENT
Nov 25, 2010
I'm writing a Perl script which performs linux commands.I have a directory with a load of files.
Code:exec_cmd('rm $(ls * | grep -v file1)');
This command will delete all except for file1. How can I modify this to delete all files except for file1 & file2?
View 2 Replies
View Related
Jul 14, 2011
We have an rsync cron job set up to mirror all the files in a "..dashtdocsdocs" folder to the same folder on another server. It copies all the files over correctly and deletes any files in the "docs" directory that aren't in the sending directory, but it also deletes any files we put in the target directory's parent folder (..dashtdocs or other subfolders like ..dashtdocsimages) even though they've been excluded in the .rsync-filter file.
Here's our current rsync .sh:
/usr/local/bin/rsync --stats -qPzrtpl --delete --password-file=/var/run/.appprodrsync --log-file=/export/home
/webuser/logs/rsync-extranet-log -FF /export/home/ appprodrsync@appprod::dprweb_extranet/ > /export/home/webuser/logs/rsync-extranet-output 2>&1
[code]....
So for example server A has ..dashtdocsdocs and ..dashtdocsimages. Server B has ..dashtdocsdocs but if I manually copy the images folder over to ..dashtdocsimages, the images folder gets deleted from the target directory every time rsync runs.
A: ..dashtdocsdocs
..dashtdocsimages
B: ..dashtdocsdocs
..dashtdocsimages (<-- gets deleted everytime rsync runs)
I'd like to keep just the docs directory synched and update other folders manually, but they keep getting deleted. It looks to me like it's running a delete-excluded option, but that option wasn't used.
View 2 Replies
View Related
Dec 2, 2010
how to write a script so that when I use the 'del' command it removes/sends the files / folders to a I specify for example 'dustbin'
View 1 Replies
View Related
Nov 14, 2010
There are millions of files in many directories. Wherenver i try rm * or find or use xargs, they say 'argument list too long' and exit. How can i deleted files in a directory with so many files without deleting the directory itself.
View 3 Replies
View Related
Jun 11, 2011
I have 2 folders that are synced using rsync. Right now if I delete a file in the source folder, the destination folder still retains that file. Is there a way to get rsync to delete files if they were deleting at the source?I could not find anything in the man page.not sure if I'm missing something or if that feature just doesn't exist.
View 4 Replies
View Related
Jun 17, 2010
I have a USB drive that I boot using SysLinux. I think select one of several options to complete a task. I do not have access to edit those Kernels. I need to add a option from the Syslinux menu where I can delete all the files from a specific directory.
View 3 Replies
View Related
Jul 23, 2010
I created a directory somewhere with permissions rwxrwxr-x so that other users in my group can create files and directories in it.
I do need to be able to delete the contents in this "public" directory, but it seems that while I am able to remove any files in this directory I cannot remove and subdirectories under it.
Is there a way to remove such subdirectories owned by others under a directory owned by me?
View 3 Replies
View Related
Dec 4, 2010
Here is how i am isolating the 7 latest files
Code:
ls -ltr | tail -7
is there a way to give that negated list to the rm command? or should i be using the find command with an exec {}?
View 14 Replies
View Related
Sep 28, 2010
I wanna delete a directory with its files and I wanna do that as follows: rm -r dirToDelete Unfortunately, I always get asked for EACH single file if I wanna delete this because it is write protected.... Is there a way to suppress this feedback message so that just the whole directory with its contents disappears?
View 5 Replies
View Related
Sep 21, 2010
I need a PHP script to delete a line with certain pattern from all filesin a directory. The Directory contain files with extensions .js,.html and.php. Do any body give a working code snippet to Read all files in a directory with above extension and delete that line from the files.
View 1 Replies
View Related
Nov 25, 2010
the permissions for my home directory were accidentally changed from 'access files' to 'create and delete files', and I changed them back, but ever since then I am not able to change any preferences/settings at all. power management, themes, panels, emerald, anything. my user account is supposed to be the administrator, and all the user privliges are checked. how to get control of my computer back?
View 9 Replies
View Related
Jun 14, 2011
i need to restrict access of deleting to directory and partitions os disk? how do i do it?
View 5 Replies
View Related
Feb 21, 2010
Something strange is happening with RedHat Linux 5. I created one directory system_verilog twice and both the times somehow it's get deleted after next booting of machine (after modification of some of the file in this directory).
View 3 Replies
View Related
Feb 16, 2011
I would like to delete a directory in emacs' dired-mode.
I mark the directory with the "d" key, and then hit "x" to deleted flagged.
I then get the following error:
Is there any way to get emacs to delete the directory and stop its whining?
View 1 Replies
View Related
Mar 18, 2010
I am facing a problem in Windows due to a virus called Newfolder.exe which creats files with the same name as it's parent directory and an extension .exe and this happens for every directory in the entire hierarchy in the infected pen drive. The antivirus detects them, but is sucking slow. So I thought this is a good opportunity to use the concepts of the all mighty shell script to remove those as they follow the same pattern. Say my complete path is
Code:
/home/pkd/fol1/
The virus would have created an file with complete paths
Quote:
/home/pkd/fol1.exe
If fol1 has two more directories fol11 and fol12 Then there would be two more .exe(virus created) in the following path
Quote:
/home/pkd/fol11/fol11.exe
/home/pkd/fol12/fol12.exe
View 1 Replies
View Related
Apr 25, 2009
my website was recently infected with this stupid malware lotultimatebet .cn...there is a hidden iframe on almost all the 6000 pages of my site.can you please advise, if it is possible for me to remove this line from all pages by executing some command?
View 1 Replies
View Related
Nov 5, 2009
I had a program run riot and it has created hundreds of spurious files in one directory. Fortunately they are all dated 4th November so are easily identified. What bash command can I use from the console to delete them all?
View 2 Replies
View Related
Sep 8, 2010
I'm using the command below to sync two directories. Problem is insted of deleting the files on the target directory it simply appends a ~ character at the end of the file name. Not sure why this is happening?I'd like to have all deletes on the source replicated on target.
View 2 Replies
View Related
Sep 8, 2009
on my site now I'm using cache and need me cron script that will delete files older than 1 hour I have feature in my kloxo control panel just need me the command .
View 2 Replies
View Related
Sep 17, 2009
Is there anyway to delete certain paragraphs within a text file and then insert the paragraph into another text file.I just cannot figure out how to remove the specific lines from the file and then insert them into another file at a certain line within that new file. Thanks again
View 10 Replies
View Related
Oct 7, 2010
Im assuming there is a simple answer for this but I have yet to find it in forums. I have 2 partitions mounted on my ubuntu desktop, one is Windows C: drive labeled "Core" and the other is D: drive labeled "Reserve" but for some reason I have a second Windows folder on my desktop, when I attempted to delete it it began to delete the Windows files as well, one forum said to right click and "remove from desktop" but this option isnt in the menu. How can I just delete the folder?
View 2 Replies
View Related
May 4, 2009
[root@localhost media]# ls UMESH
[root@localhost media]# cd UMESH/
[root@localhost UMESH]# ll
ls: cannot access ejb: Input/output error
total 0 d? ejb
[root@localhost UMESH]# rm -rf ejb
rm: cannot remove 'ejb': Input/output error
[root@localhost UMESH]# ll
ls: cannot access ejb: Input/output error
total 0 d? ejb
[root@localhost UMESH]#
The privileges for root for UMESH are as below:
[root@localhost media]# ll
total 4
drwxr-xr-x 3 vickey root 4096 1970-01-01 05:30 UMESH
[root@localhost media]#
Also I can't even paste a file in the USB.
View 7 Replies
View Related
Oct 24, 2010
I have a question, that may sound silly. I have removed VirtualBox from my Ubuntu install. But the .VirtualBox folder is still existing with a virtual drive of nearly 10 GB. Can I manually remove the folder .VirtualBox with rm -rf without any unwanted side effects?
View 2 Replies
View Related
Jan 10, 2011
I copied a back up of my windows 'my documents' fold and all of its' sub folders into my linux (Mint Debian) Documents directory. I found that many of my files can be found in more that one directory so, what I want to do is to find all the dups and deal with them. Is there a good linux application to resolve this 'duplicates' problem. (I don't want to touch the linux system files.)
View 2 Replies
View Related
May 15, 2011
I have a FAT32 SD card with a file on it, that, viewed in Windows the filename consists of a long string of nonsense. Viewed in my Android phone's Linux terminal, ls -a shows nothing in the directory. When I try to delete the parent directory with rm -rf deleteme, it fails with "Directory not empty". When I try to delete/move in Windows 7, it says the filename would be too long and/or Explorer crashes. Windows disk check doesn't find anything wrong. How can I delete this?
View 2 Replies
View Related
Dec 22, 2009
After running photorec I went from having ~30 gb of free space to having 0 bytes of free space. I have deleted all the results of photorec and various other large files and removed them from trash but it still has not freed up any space. Also, my firefox no longer has back/forward functionality which I'm sure would be fixed by a reinstall but seeing as I have 0 space, I can't really do that. Any thoughts?
View 7 Replies
View Related
Oct 11, 2010
I am trying to dl the files located here: http://good.net/dl/bd/CCCamp-2007/video/m4v/ using wget.
Now when I use the command wget -r -A .m4v http://good.net/dl/bd/CCCamp-2007/video/m4v/
I get the just a bunch of filefolders, but no files, ex."cccamp07-de-1845-Freifunk_und_Recht.m4v" but its a folder.
View 4 Replies
View Related
Dec 20, 2010
How to create a directory in samba share in which user can write read files but neither can create more directories tree nor delete any directory.
suppose
[Share]
comment = NRshare
path = /home/share
browseable = yes
[Code].....
I know user cannot delete share directory here. But user can create any number of directories of files in share.
I would like to create directories in share which cannot be added or deleted.
View 2 Replies
View Related
Sep 21, 2010
If I am logged in as root in a linux system and I run command rm -rf on / folder, should it remove all the files? also the kernel?
View 4 Replies
View Related