Questions tagged [file-management]

103 questions
423
votes
9 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,705
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,631
12
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
  • 28,966
3
votes
3 answers

ls option to list files without reference to extension?

We use a numeric version control for files (ex: report01.log.01, report01.log.02, report01.log.03, etc.) What I need to do is produce a list each file and the number of versions the file has. Does Linux has a function to do this relatively easily?
Richard
  • 39
  • 1
  • 2
3
votes
3 answers

Copying all files from one directory to all directories under same parent directory

I have one parent directory /home/test and under that directory I have multiple directories. The names are server{1..10} and one of them server3 has few files which I have copied from remote server. I tried to use cp but it's not working for me. …
user67186
  • 497
0
votes
2 answers

same files from different directories

How to list and compare the similar files from different directories using single command on Linux? Let's suppose there are three files a, b and c in directory /home/test and a, d, c files in another directory, /home/test1. How can I list and…
-1
votes
1 answer

arranging files in a folder according to another folder

I've 2 folders. Folder 1 has some files arranged in some sub folders. Folder 2 has same-filenamed-files (but different size) but not arranged in any sub folder. I want to arrange folder 2 files like folder 1. Is there a quick way to do that? I'm…
kan
  • 1