Editing
Linux commands
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Delete files or directory === delete all files or directory * {{kbd | key=rm -rf ''/Name_of_directory''}} to delete all files under the '''Name_of_directory'' ({{Linux}})<ref><nowiki>[OPTION]</nowiki> * -r remove directories and their contents recursively; * -f ignore nonexistent files, never prompt (above content cited from linux documentation: rm --help) </ref> * {{kbd | key=del ''Name_of_directory''}} ({{Win}}) ** After executed ''del Name_of_directory'' but the empty directory directory_name will be left. ** Command delete is not available in Win XP * rsync ** {{Gd}} quick for many small files (1) create a empty folder ex: {{kbd | key=<nowiki>mkdit /path/to/source</nowiki>}} (2) To empty the target folder, keyin {{kbd | key=<nowiki>rsync -avP --delete /path/to/source/ /path/to/target/</nowiki>}} ({{Linux}}) ** {{kbd | key=<nowiki>rsync --delete-before -a -H -v --progress --stats /path/to/empty/folder/ /path/to/target_folder_will_be_deleted/</nowiki>}} ({{Linux}})<ref>[http://blog.sina.com.cn/s/blog_5f5a3dff0101e2tm.html Linux下使用rsync最快速删除海量文件的方法_果冻的剥壳_新浪博客]</ref> ''un-verified'' * Using SFTP/FTP to connection to the server and delete selected files. {{exclaim}} It may costs too much time if there are many files or sub folders! Delete the files which their file name were matched with the ''naming rule'' when the number of files is too many. * {{kbd | key= <nowiki>find . -name 'naming_rule' -delete</nowiki>}} or {{kbd | key= <nowiki>find . -name 'naming_rule' -type f -delete</nowiki>}} <ref>[http://danilo.ariadoss.com/how-to-recursively-remove-ds_store-files-on-mac-os-x/ How to recursively remove .DS_Store files on Mac OS X | Tangential Musings]</ref><ref>[http://xyz.cinc.biz/2015/12/linux-rm-argument-list-too-long.html XYZ的筆記本: Linux 使用 rm 刪除檔案,出現 /bin/rm: Argument list too long]</ref><ref>[http://www.hypexr.org/linux_find_help.php Linux find command]</ref>
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
Tools
What links here
Related changes
Special pages
Page information