A file system structure in which to store computer files.

learn more… | top users | synonyms

1
vote
1answer
787 views

mount.cifs not respecting file permissions in Ubuntu 12.04.2 LTS

I am attempting to mount a cifs drive in standard Ubuntu 12.04.2 LTS using the following line in /etc/fstab: //server-name/share-name /mnt/archive cifs ...
3
votes
2answers
59 views

Is there a way to condense ../.. parts of a path out programatically?

Say for example I have these types of paths to files in a script: /path/to/some/file/../../file1.txt Is there a command I can call such as readlink that will convert this path to its actual ...
2
votes
2answers
561 views

\uFFFD character in directory name

I have a lot of directories with a \uFFFD (65533) character in it. The problem is that I can't really access this directory because of this character. For example I got a directory with the name: ...
6
votes
4answers
483 views

set read and write permissions to folder and all its parent directories

I need to set read and write permissions for root user to directory subfolderN and all its parent folders till root. I can do it by hands: $ sudo chmod +rx /root/subfolder1/subfolder2/subfolderN $ ...
23
votes
12answers
3k views

What's the most resource efficient way to count how many files are in a directory?

CentOS 5.9 I came across an issue the other day where a directory had a lot of files. To count it, I ran ls -l /foo/foo2/ | wc -l Turns out that there were over 1 million files in a single ...
2
votes
1answer
88 views

bash - inherit directory stack in children

If, in my newly created bash, I do: pushd foo pushd bar dirs -l -v I will get something like 0 bar 1 foo 2 old_dir If I then do bash dirs -l -v I get only 0 bar The same thing happens ...
3
votes
2answers
1k views

Automatically moving files to a directory, one by one, and only when the target folder is empty

Is it possible? And in reverse alphabetical order? Essentially, this: How can I move files by type recursively from a directory and its sub-directories to another directory? Except that each file is ...
3
votes
3answers
750 views

Merging two directory without copying the files

Let's say I have as follows : Folder A C1 file a A2 Folder B C1 B2 file b B3 What I want is to merge these two folders, which would give me : Folder C ...
1
vote
1answer
89 views

If I hardlink to a directory, will the contents be “preserved” as if I hard-linked to every file?

I've seen people on the internet talk about using hardlinks to force files to stay on disk as a backup, even if they're deleted in their original location. Would this work for a directory too? Why or ...
1
vote
3answers
258 views

Group+rx permission only in directories using ACL?

I need to install acl in order to set up a very specific permission structure. Group members should be able to see the files in a directory and change into the subdirectories. However, they should not ...
2
votes
2answers
415 views

In Linux, is 'make folder/path/clean' same as running 'make clean' command in folder/path?

I'm new to Linux, more so for Makefile. In Linux, is 'make folder/path/clean' same as running 'make clean' command in folder/path/? (folder/path/ refers to an arbitrary directory.) Apart from this ...
1
vote
2answers
1k views

Find and move directories based on file type and date

I have a directory "New Movies" containing 200+ subdirectories "Movie Name (year)". The subdirectories "Movie Name (year)" contains a single video file (avi/mkv) and several related jpg/xml files. I ...
0
votes
2answers
515 views

Delete all files except certain subfolder [duplicate]

I want to recursively delete all files not accessed in a while in folder a, except all files in the subfolder b. find a \( -name b -prune \) -o -type f -delete However, I get an error message: ...
5
votes
1answer
634 views

Why is this empty directory 3.5MB?

I've just read this question: What does size of a directory mean in output of 'ls -l' command? ...which doesn't quite answer my question. Basically, I'm moving files onto a NAS. The folders ...
3
votes
3answers
2k views

How to determine how many files are within a directory without counting?

I've been having a fairly serious issue on a high traffic web server. PHP pages are slowing down considerably, and it only seems to be an issue on pages where sessions are accessed, or a certain table ...
20
votes
8answers
15k views

How do I loop through only directories in bash?

I have a folder with some directories and some files (some are hidden, beginning with dot). for d in *; do echo $d done will loop through all files, but I want to loop only through directories. ...
4
votes
3answers
112 views

How to condense subdirectories

I have one directory with many sub-directories. All of those sub-directories contain files which each have unique names. I want to take all the files from all of the sub-directories and move them all ...
3
votes
2answers
153 views

Preventing accidental directory deletion. Making an alias that contains options?

I use an alias to prevent me from accidentally deleting files, and I would like to do something similar for directories. For files, I have the following added to my .bashrc: alias rm="rm -i" I ...
7
votes
1answer
230 views

Boot into a chroot?

I have Linux (Debian Jessie) installed on a hard drive. Drive - sda1, ext4fs, and sda2 - swap I have a /chroot folder. There is installed another system, in /chroot folder. Question: How to tell ...
1
vote
0answers
41 views

Directory size as reported by stat on NTFS

We all have seen gazillions of directory size reports from ls or stat. We know they don't mean real size of the content, but they do have meaning, but since the meaning is not very useful for normal ...
2
votes
1answer
318 views

Allow world access to directory under 0750 directory

I prefer to keep my /home/dotancohen/ directory as permissions 0750. However, I do need Apache to access /home/dotancohen/someProject/public_html/. I know that I could configure the home directory as ...
4
votes
2answers
56 views

List all directories that do NOT have a file with a given file name inside

How would I go into listing all directories that do not have a file with a given file name inside? e.g. given this tree / /a README file001 file002 /b README file001 /c ...
2
votes
5answers
177 views

List a directory but only if it contains sub-directories?

In Unix, is it possible to use one command ONLY to list directories if they contain a sub-directory? For example, I would like to list the directory name if it contains a sub-directory called ...
1
vote
3answers
79 views

Mode to set Directory in Only READ-WRITE mode

Can anyone tell me how to set a directory only in read/write mode as below? -rw-rw-r-- I tried with 640,644 but I am able to achieve...
3
votes
2answers
126 views

How to make directory modication date change when files from that dir change?

For example, if a file has been changed in that directory, then directory modification date should be updated. Basically any changes that happen in that directory should trigger a "touch" on the ...
0
votes
2answers
969 views

How to create nested directory in a single command? [duplicate]

Apparently, it's not possible to create a nested directory in a single command? $ sudo mkdir x/y/z mkdir: cannot create directory 'x/y/z': No such file or directory
12
votes
1answer
16k views

Create a symbolic link relative to the current directory

I'm trying to create a symbolic link in my home directory that points to a directory on my external HDD. It works fine when I specify it like this: cd ~ ln -s /run/media/name/exhdd/Data/ Data ...
3
votes
1answer
745 views

How to download all html files from a URL's directory with wget?

I'd like to use wget to download a tutorial in a website, but this tutorial is in a specific directory. Suppose the URL is the tutorial main page http://www.abc.com/aaa/bbb/ccc/index.html. But the ...
2
votes
2answers
46 views

Average number of subdirs

I have a directory which contains a number of subdirs. Each of these subdirs again contains a number of subdirs (call them subsubdirs). Now I would like to count the average number of subsubdirs in ...
0
votes
2answers
59 views

chowning each home user to itself recursively

Okay so I have about 100 directories in my home folder each owned by the home user itself. Sometimes I have to manually replace some files as root so the permissions are disturbed and some files are ...
1
vote
3answers
59 views

Rename directory from within directory?

How would I rename a directory from within that directory? For example: ~/tmp $ rn tmp2 ~/tmp2 $ I can do that with: cd .. && mv tmp tmp2 && cd tmp2, but not sure how to make it ...
0
votes
1answer
428 views

Find and remove sub-directories without error?

I need to find a way to remove sub-directories from within a particular directory without receiving an error if no sub-directories exist. This command will successfully remove sub-directories if they ...
1
vote
2answers
1k views

Cheapest way to find the oldest file (recursively) from a directory under heavy load

What is the least expensive way to find the oldest file in a directory, including all directories underneath. Assume directory is backed by SAN and under heavy load. There is concern that "ls" could ...
2
votes
3answers
216 views

Safer way for granting permissions for self user?

I know sometimes we can do chmod 777 so we have a directory at our complete reach for accessing, reading and writing. But usually I prefer to do a sudo chown {myusername} {directory}. Obviously, the ...
3
votes
3answers
212 views

Quick access to work directory of background job

Minimal effort to reproduce what I am looking for, is as follows /$ sleep 1h & [1] 6564 /$ cd ~$ jobs [1]+ Running sleep 1h & (wd: /) When I use jobs to manage my ...
1
vote
2answers
54 views

Copying Files in a Folder To Individual Folders

This might sound like something quite odd but for my HTPC, I need to rearrange how my files are stored such that each of the individual files in a folder needs to be moved to a subdirectory of its own ...
1
vote
3answers
263 views

rsync only subdirectories and content

I have a directory that contains a number of files and subdirectories. See below: baseDir bad1 bad2 subDir1 file1 subDir2 file1 I would like to rsync the contents of baseDir without ...
3
votes
2answers
140 views

Refer to an item in `dirs`

I use pushd to work with multiple directories in bash and zsh. I've aliased dirs to dirs -v so that I get an ordered list when I want to see what's on the directory stack: chb$ dirs 0 ...
4
votes
1answer
133 views

Customised vimrc for subfolders and projects

I use vim in many different contexts ... actually, probably most people do: There is the editing of configuration files, programming, documenting, email and so forth. I very frequently found myself ...
2
votes
1answer
46 views

Procmail standard base path for directory delivery

I had trouble with procmail not wanting to deliver my mail to a specific folder. I had: DEFAULT=/home/vmail/${ER_DOMAIN}/${ER_USER}/ :0 * ^To:.*my-email * ^Subject:.*some-filter .the-dir/ But got ...
2
votes
1answer
74 views

How can I make multiple copies of one folder without merging?

When two or more identically named folders are to be copied into or moved to the same location, the default option either in the GUI file manager, or using in a terminal cp -r --backup=numbered or ...
3
votes
2answers
2k views

Where do installed RPMs go?

I download and install packages on my Red Hat Enterprise Linux Server 6 machine using YUM package manager in command-line mode. When I install apk files on my Android phone, they go to /data/app ...
4
votes
2answers
224 views

Permissions by path instead of file mode bits

I often find that the unix way of handling file permissions is powerful, particularly when combined with ACLs, but rather difficult to handle. Setting file modes, group ownership and extended ...
2
votes
2answers
666 views

Prevent creating directories but allow creating files

I have a directory shared through Samba. I want users to be able to create/modify/delete files but not create/erase directories. I haven't found a way to do it. Maybe with SELinux? But how?
6
votes
5answers
705 views

Making a directory protected from 'rm -rf'

I just lost some data in folder A which was inside folder B after doing rm -rf B. Before I could realize what have I done, it was all over. Now a lesson is learnt, I wish to make some of my folder ...
0
votes
1answer
86 views

What is the common name for directories . (dot) and .. (dot dot)? [closed]

The . (dot) and .. (dot dot) exist in every directory (and probably in every OS). As we all know (or at least should): . (dot) is the current directory .. (dot dot) is the parent directory Is ...
1
vote
2answers
3k views

cat files in current folder and all subfolders [duplicate]

I want to cat a file in current folder and all files in all subfolders (and subsubfolders). Here is my directory structure $ tree . ├── f │   └── foo └── yo I want to cat foo and yo. I've tried ...
5
votes
3answers
593 views

Walking through files in directory randomly

How to change for track in *.mp3; do so that all .mp3 files in the current directory are walked through but in a random way?
2
votes
4answers
110 views

find command: how to ignore pathname?

I have to find some type of files in a directory and it's subdirectories and I only have to print out the filenames. So here's the main command: find -type f -name "*.c" Now, how could I cut the ...
3
votes
1answer
100 views

How can I delete a hardlink to a directory?

Before I get 100s of answers that tell me it is impossible to hardlink directories in linux: yes, I know that. The file in question appeared in lost+fount after I checked the filesystem with e2fsck ...