Questions tagged [directory]

A file system structure in which to store computer files.

Filter by
Sorted by
Tagged with
2
votes
1answer
25 views

How can I encrypt my folder so there is no access to its contents?

I was able to encrypt a directory so that it can not be deleted. And I encrypted the file in the folder. But then I was able to delete the encrypted file in the encrypted folder, in which case, ...
0
votes
1answer
31 views

Efficient way to output text file lines into a directory tree

Example: test.txt coolname lineinfile Output: coolname would be placed at c/o/o/l/n/a.txt lineinfile would be placed at l/i/n/e/i/n.txt Any help would be appreciated
3
votes
3answers
12k views

How can I have a separate umask for directory or user?

I want a separate umask for a directory or a user. How can I do this? Edit: I am using Debian 6. The reason why I want to do this is, I want all my SFTP users to create files with write on group. ...
0
votes
1answer
1k views

xfs directory quota doesn't work

I have two tasks and I want to run them in different directory and limit the directory's size. I use xfs's project quota to achieve this. I follow the steps from here:https://solidlinux.wordpress.com/...
0
votes
0answers
9 views

Take similarly named fastq files on a folder and amke them input for an script(on pairs)

I have a set of files named like this inside a folder: AM11_BW415_R1.fastq.gz NAM13_BW968_R2.fastq.gz NAM17_AC_Barrie_R1.fastq.gz NAM3_PI648600_R2.fastq.gz NAM7_Glenlea_R1.fastq.gz ...
128
votes
8answers
53k views

Why are hard links to directories not allowed in UNIX/Linux?

I read in text books that Unix/Linux doesn't allow hard links to directories but does allow soft links. Is it because, when we have cycles and if we create hard links, and after some time we delete ...
53
votes
14answers
38k 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
2answers
2k views

Diff between local and remote directory

I want to compare my local directory and remote directory. Example: Consider 2 directories as local and remote directory |-local | |--aaa | | |--file1 | | |--file2 | | | |--bbb | | |--...
1
vote
0answers
14 views

How to move files with a particular timestamp in linux?

I want to move some files from /usr/local/packageA directory to /usr/local/packageB directory. I accidentally installed both the packages in the same directory and want to move the files which were ...
-1
votes
1answer
63 views

How to copy files one by one to different folders?

In a directory I have files with the names: 01.txt 02.txt 03.txt In the same directory are folders with the names: 01.abc 02.def 03.ghi I need a command to copy the files to the folders one by one,...
0
votes
0answers
5 views

Window minimizing when ROS checking log directory for disk usage

I would like to have a window maximized 24/7 but it is minimizing every time when the ROS log directory is checked for disk usage. Getting message Checking log directory for disk usage. This may ...
-1
votes
4answers
6k views

cannot move Directory not empty

Edited due to people want to know more then me just wanting to know how to deal with two directories with same names in different places and move one into another when mv will not allow it if files ...
34
votes
4answers
142k views

How can I delete all files with a particular extension in a particular folder?

If I set the current/working directory (navigating to it using cd) to some particular directory and then type: rm *.xvg What will this command do? Is it true that the above command will only delete ...
0
votes
1answer
33 views

to apply counters on directories inside a folder

I've a folder structure like this: drwxr-xr-x 2 root root 4096 Jun 30 21:34 dir_0.0.1_2 drwxr-xr-x 2 root root 4096 Jul 2 23:45 dir_0.0.1_1 -rw-r--r-- 1 root root 24 Jul 3 00:03 a.sh drwxr-xr-x 2 ...
25
votes
5answers
95k views

“cannot remove 'some_directory': Directory not empty”

I tried to delete some directory, but $ rm DE.aspx_files -r rm: cannot remove `DE.aspx_files': Directory not empty But listing its content returns none $ ls DE.aspx_files $ Added: Actually $ ls -...
6
votes
1answer
315 views

Why can't you move another user's directory when you can move their file?

Following on from another user's question I've bumped into a quirk of Linux filesystem permissions that I can't easily rationalize: sudo mkdir ~/foo ~/foo/bar sudo touch ~/baz mkdir ~/my_dir chown ...
2
votes
1answer
35 views

Can we preserve the timestamp of parent directory after modifying the files inside it?

I have a folder structure: /home/us3r/scripts I've some scripts inside the scripts folder. Now, i want to preserve the timestamp of the scripts folder even if someone does a vim and saves any of the ...
2
votes
4answers
41 views

how to cut first 3 folders from this echo “/home/test/var/opt” ? i need the result “/home/test/var”

How to cut first 3 folders from a string? For example: echo "/home/source/Oracle/test" |cut -d'/' -f4 gives only one folder name, but I need up to the 3rd folder, like below: echo "/home/test/...
54
votes
3answers
35k views

Difference between “cd -” and “cd ~-”

The Bash command cd - prints the previously used directory and changes to it. On the other hand, the Bash command cd ~- directly changes to the previously used directory, without echoing ...
2
votes
4answers
71 views

Delete folders but keep 20 newest, 7 days old

I am looking for a way to delete folders that are older than 7 days, but always have 20 newest folders. similar named folders with _SAME_NAME_@tmp should be deleted as well. I'm stuck with making ...
0
votes
1answer
39 views

Move files to specific folders based on name

I have this file/folder scheme: /Aula /Aula01 /Aula02 aula-01.1.mp4 aula-01.2.mp4 aula-01.3.mp4 aula-02.1.mp4 aula-02.2.mp4 aula-02.3.mp4 All the mp4 files are located in the root directory (...
239
votes
12answers
364k 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. How ...
-4
votes
2answers
48 views

Forgot to put a slash before download path, where were these files downloaded to?

I forgot to put a slash before my home folder when downloading some files and it seems that they downloaded successfully but I can't seem to navigate before / within my thunar explorer so I can't get ...
0
votes
1answer
74 views

How do I write a shell script to flatten directories?

I wrote a simple script to delete useless files from a directory using the find command. Now I'm wondering if I can add lines to the script to flatten directories, but not completely flattened. e.g.,...
3
votes
1answer
345 views

Passing all files of specific filetype in current and subdirectories

I have constructed an elaborate 500+ character command with many arguments and switches to autosign multiple PDF documents. I'm using JSignPDF and I'd like to use it's batch mode including the ...
84
votes
7answers
65k views

The result of ls * , ls ** and ls ***

I know using the command ls will list all the directories. But what does the ls * command do ? I used it and it just lists the directories. Is the star in front of ls means how deep it can list the ...
366
votes
8answers
254k views

Execute vs Read bit. How do directory permissions in Linux work?

In my CMS, I noticed that directories need the executable bit (+x) set for the user to open them. Why is the execute permission required to read a directory, and how do directory permissions in Linux ...
0
votes
2answers
21 views

User for group able to delete file even though the user has only read access to the file through group

I have a directory with the below permissions: drwxrwsr-x 3 john ro 20K Jun 20 14:48 logs I logged in as john and touched a new file inside logs: -rw-r--r-- 1 john ro 0 Jun 20 14:48 d From my ...
0
votes
0answers
29 views

Can tmpfiles.d remove only files but not directories based on time?

I want to empty /scandir/ of all files including files in sub directories but I don't want any directories themselves removed, which is what happening with the following in /etc/tmpfiles.d/test.conf: ...
3
votes
0answers
56 views

When coding for Unix/Linux is it convention to use a trailing slash on path names, or to omit it? [duplicate]

When programming for Unix/Linux, is it best practice to use a trailing slash, or to omit it? For example: Trailing slash baseDir="/path/to/dir/" #code# outPath=${baseDir}addition/to/path/ No ...
251
votes
4answers
401k views

How to set default file permissions for all folders/files in a directory?

I want to set a folder such that anything created within it (directories, files) inherit default permissions and group. Lets call the group "media". And also, the folders/files created within the ...
2
votes
2answers
37 views

authorize wheel group to rm in specific folder

I would like to authorize wheel group to rm in a specific folder (in this case my folder is "CT"). I've tried to add this line in visudo: %wheel All=(ALL) /bin/rm /CT/ I have a test files "test1" ...
12
votes
1answer
8k views

gpg: WARNING: unsafe ownership on homedir '/home/user/.gnupg'

System: I am testing Linux Mint 19 Beta based on Ubuntu 18.04. I got this warning while installing an unrelated package: gpg: WARNING: unsafe ownership on homedir '/home/vlastimil/.gnupg' This is ...
1
vote
2answers
52 views

Command for getting path to mount point of current partition/drive?

Is there an alternative command that does the same thing as findmnt -T . -o TARGET |tail -n 1? Example: If my current working directory is /media/username/HDD/subdir1/subdir2, that command would ...
1
vote
1answer
51 views

Tools to lock/encrypt folder in debian

Is there any tools to encrypt folder except encfs for debian?
110
votes
12answers
96k views

How to XZ a directory with TAR using maximum compression?

So I need to compress a directory with max compression. How can I do it with xz? I mean I will need tar too because I can't compress a directory with only xz. Is there a oneliner to produce e.g. foo....
51
votes
5answers
104k views

How do I remove all sub-directories from within a directory?

This question is kind of a phase II to the first question I posted at here I have a directory that contains a bunch of sub-directories, .zip files, and other random files not contained within a sub-...
0
votes
1answer
16 views

Explaining xargs output from two find commands

I have a directory structure of folder1 folder2 folder2a folder2b folder3 folder3a folder3b I am confused by the xargs output of the below command: XXXXXX:folder1 user$ find . -type d -...
13
votes
5answers
15k views

Move every file that is not a directory

I have a directory that I am trying to clean out that contains both files and subdirectories. What I am trying to do is simple: move all the files into another directory, but leave all the sub-...
0
votes
2answers
29 views

Copying diff results files

I have two folders - Folder A and Folder B. I compared the files from both folders using diff command. Now after finding that certain files are only available in Folder A and Certain files in Folder ...
1
vote
2answers
58 views

Why does `find -type d -exec rmdir {} \;` command produce “No such file or directory message”

For testing purposes, I created the following directories. user@linux:~$ mkdir dir0{1..3} user@linux:~$ ls -l total 12K drwxr-xr-x 2 user user 4.0K Mei 31 10:45 dir01 drwxr-xr-x 2 user user 4.0K ...
1
vote
1answer
42 views

What does it mean to open a directory in vim?

I did vim myDirectory, and got weird output that I don't know how to interpret.
0
votes
2answers
58 views

Compare two directories for a certain extension and then move the missing ones to a new directory [closed]

Editing and changing the verbiage to make it more clear - I have .dm4 files in both dirA and dirB. My reference folder is dirA and I want to list all the .dm4 files which are missing in dirA which are ...
0
votes
1answer
28 views

Default Directories Not Working In OpenSSL Configuration File

I have set the directory in the /etc/ssl/openssl.cnf file but every time I issue the command openssl req -x509 -newkey rsa:4096 -keyout cakey.pem -out cacert.pem -days 3650 it places the files in ...
10
votes
3answers
986 views

Remember “local” bash history in a folder?

I have a script in a folder that I use with long arguments. Is there any chance I can have an history of the commands executed in that specific directory instead of going back through the entire ...
0
votes
1answer
41 views

How to find duplicate directory paths even if the contents are different?

I've searched high and low but it seems all but one (Find and list duplicate directories) topic I've found actually deals with my situation, and the result isn't quite what I need. Edit: Here's some ...
0
votes
1answer
59 views

Restore function in unix

I have a script to recover files back to their original location. I am missing the options for the script to as "Do you want to recover this file?" Yes or No. How will I implement it into this code ...
10
votes
6answers
14k views

How do you check if a file exists within awk? [-d 'filename'] failing

I'm trying to generate a list of users who have a home directory set which does not exist. It seems I should be able to do this with awk, but something is wrong with my syntax. It keeps telling me "...
59
votes
7answers
83k views

rsync compare directories?

Is it possible to compare two directories with rsync and only print the differences? There's a dry-run option, but when I increase verbosity to a certain level, every file compared is shown. ls -alR ...
0
votes
2answers
2k views

move multiple directories in one directory - recursively

I have a directory which contains multiple directories including subdirectories too. I want to move some of them to a single one at the same time (with one command) Example Main Directory Sub1 ...