Questions tagged [file-management]
100 questions
408
votes
8 answers
Remove all files/directories except for one file
I have a directory containing a large number of files. I want to delete all files except for file.txt . How do I do this?
There are too many files to remove the unwanted ones individually and their names are too diverse to use * to remove them all…
Kantura
- 4,555
- 4
- 14
- 12
133
votes
4 answers
How do you do a dry run of rm to see what files will be deleted?
I want to see what files will be deleted when performing an rm in linux. Most commands seem to have a dry run option to show just such information, but I can't seem to find such an option for rm. Is this even possible?
Cory Klein
- 18,391
- 26
- 81
- 93
25
votes
4 answers
Disable "Recently used" in GTK file/directory selector
Can I completely disable "Recently Used" feature in GTK's file / directory selector?
Sometimes programs default to this but since it's not useful in my work-flow and with the way I organize my files, it only adds confusion:
I usually just expect…
Alois Mahdal
- 4,330
- 11
- 40
- 62
22
votes
4 answers
Where should small utility programs store their preferences?
I have several utility programs that do not have their own directory and are just a single executable. Typically I put the binary in /usr/local/bin. A problem I have is how to manage preference settings.
One idea is to use environment variables and…
Tyler Durden
- 5,411
- 16
- 57
- 96
18
votes
1 answer
How can I sync two local directories?
I have two backup directories (dir1 and 2) on two different (local) HDDs and I want to create one of them. How can I really sync their contents so that both directories will have the same contents?
Weylyn Savan
- 553
- 3
- 8
- 18
15
votes
6 answers
How to de-unzip, de-tar -xvf -- de-unarchive in a messy folder?
Usually, I unarchive things by $ mkdir newFolder; $ mv *.zip newFolder; $ cd newFolder; $unzip *.zip but sometimes I get lazy and just do in an arbitrary folder $ unzip *.zip so time-to-time messing up with other content. I will list here some…
user2362
14
votes
4 answers
How to sort files by part of the filename?
Given the files below:
ABC38388.SC01.StatueGrade_MKP
ABC38388.SC02.Statue_GKP
DEF38389.SC03.Statue_HKP
XYZ38390.SC00.Statue_WKP
How can I list them all based on the SC value, like…
MRKR
- 161
- 1
- 2
- 5
13
votes
2 answers
how to speed up tar, just build a package without compression
I have a large folder, 2TB, with 1000000 files on a Linux machine. I want to build a package with tar. I do not care about the size of the tar file, so I do not need to compress the data. How can I speed tar up? It takes me an hour to build a…
Guo Yong
- 131
- 1
- 5
10
votes
4 answers
How to disable trash can in Thunar/XFCE?
I found myself always holding Shift when I delete a file with Thunar (the XFCE file manager).
When I was using Windows I was always disabling "recycle bin" immediately after installation. I've looked for similar option in Thunar settings but had no…
Ivan
- 17,368
- 35
- 93
- 118
10
votes
5 answers
Alternative command for coloured viewing the size of all files and folders
Is there a nice alternative for this? I always use
du -shc *
to check the size of all files and folders in the current directory. But it would be nice to have a colored and nicely formatted view (for example like dfc for viewing the sizes of…
rubo77
- 27,777
- 43
- 130
- 199
9
votes
4 answers
Search and Delete duplicate files with different names
I have a large music collection stored on my hard drive; and browsing through it, I found that I have a lot of duplicate files in some album directories. Usually the duplicates exist alongside the original in the same directory.
Usually the format…
Cestarian
- 1,991
- 5
- 26
- 45
8
votes
4 answers
Copy/rename multiple files using regular expression (shell script)
I have a collection of files matching a pattern such as 'assignment02.cc', 'assignment02.h', 'assignment02.txt', etc. I would like to copy/rename these files into 'assignment03.cc', 'assignment03.h', 'assignment03.txt', and so on.
I suspect this…
user4632
8
votes
1 answer
Git - handle symlink as if it was a file
Is there a way to make git handle a symlink as if it was a file. If I just normally add a symlink like git add symlink, git just stores/controlls the path to the file, not the linked file.
Is it possible to make git handle a symlink as if it was the…
nath
- 5,430
- 9
- 45
- 87
8
votes
3 answers
How to delete old backups based on a date in file name?
I have a daily backups named like this:
yyyymmddhhmm.zip // pattern
201503200100.zip // backup from 20. 3. 2015 1:00
I'm trying to create a script that deletes all backups older than 3 days. The script should be also able to delete all other files…
Joudicek Jouda
- 271
- 2
- 3
- 7
8
votes
4 answers
How to move all files inside present subfolders up here
I have 50 folders with some subfolders too, with more than 1000 audio files total. I need to remove all subfolders and put all files in present level. Tried mv */* ./ but it complaints: argument list too long
Pedro Gonzalez
- 231
- 1
- 2
- 4