Questions tagged [directory]

A file system structure in which to store computer files.

Filter by
Sorted by
Tagged with
1
vote
1answer
30 views

How can I find the ancestor directory with a given name?

How can I find the path of a parent directory with a particular name? For instance, say I have directory /a/b/c/d/e/f/g and I want to find the parent directory with name c, I would want this to ...
0
votes
2answers
71 views

What does --strip-components option means?

I want to make sure I understand the command --strip-components so that I could understand more complex commands that include it (such as this one). From info man of GNU tar (paraphrased): --strip-...
1
vote
1answer
66 views

How to divide a file to different subdirectories

I have a file that contains a story. I need to split the file in a way that each chapter (chapter starts with the word 'chapter') will be in diffrent directory. CHAPTER count as- everything that ...
0
votes
1answer
29 views

tar (child): : Cannot open: Is a directory

I know thats a pretty dumb question but I didn't found this precise question on internet I try to tar -cvjf all the contents of a directory (/*) and directly redirect that to a file (> file) but ...
0
votes
1answer
27 views

What is the full list of rules that defines permissions on a newly created file in a directory?

I have a directory that has rwxrwxr-x and -s- permission settings, if I create files in this folder from user A these files gets permission rw-rw-r--, and with user B it gets rw-r--r--. I'm really ...
0
votes
1answer
26 views

How to find the number of files (not directories) recursively inside a directory, excluding a glob pattern?

I used some aproximation: tree html | wc -l but now I require to exclude a glob pattern from the list of found files. The glob pattern would be something like this: (node_modules|.git|wp-snapshots). ...
1
vote
0answers
22 views

Directory with thousands of files can't be deleted on MacOS Mojave

I am running on macOS Mojave version 10.14.6. I wrote a program that creates files. It had a run away accident and created a huge number files in a directory. I don't know how many files it created ...
1
vote
3answers
50 views

How do you move all files and subdirectories from one folder to another. MV command doesnt move and subdirectories

I just want to move and overwrite all the files and folders including any subdirectories and their files to another folder and its subfolder. I have tried the following commands, but they don't work ...
0
votes
1answer
26 views

-bash: cd: No such file or directory error showing But the Folder is Exists

Iam using CentOS7 for my webserver. I got an error while try to open a directory via SSH. ls -l command shows like this drwxr-xr-x 2 ag007 ag007 38 Mar 17 13:52 Gullane -rw-r--r-- 1 ag007 ag007 0 ...
0
votes
1answer
27 views

How to find out where different packages are installed?

While downloading different packages(For example, Xbindkeys) I was having difficulties finding the different files. How does one know which directories downloaded files are in? Is there a command to ...
0
votes
0answers
18 views

Unable to use Winetricks in pop os

E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied) E: Unable to lock directory /var/lib/apt/lists/ W: Problem unlinking the file /var/cache/apt/pkgcache.bin - ...
4
votes
3answers
292 views

Rename all hidden directories created by GNU parallel

GNU Parallel is outputting hidden directories as follows using the --results parameter. What command do I use on Ubuntu to change the all to directories so that they are no longer hidden. The ...
0
votes
2answers
44 views

Sorting folders in Unix by starting with the second character

I am trying to sort the listing of directories by starting with the second character. For example, if I do the code below, the listing of the directories are in order based on the first character. $ ...
0
votes
3answers
35 views

Can I list a directory with `-wx` permissions by brute force?

As I understand it, denying a user the reading permission on a directory should prevent them from listing its content. Giving them the execute permission allows them to access its content, but only if ...
0
votes
1answer
31 views

Is it possible that size of directory exceed one block size?

I have known that in Linux one directory must occupy one data block to store file links consisting of inumber or sth. else. However, if there are thousands of files in this directory, is it true that ...
0
votes
0answers
25 views

Need help to create a checksum file of a directory on linux

I backup my data to an external hard drive regularly, and in the past, some of the files ended up getting corrupted and I haven't noticed it until it was too late. So to prevent this, I would like to ...
0
votes
3answers
40 views

How to restore a directory overwritten with mv?

I was planning to move a directory into another. The intended command is mv evaluateA2P/ action2pose_bk/evaluateA2P/ However, I had a typo and executed mv evaluateA2P/ action2pose_bk/ evaluateA2P/ ...
0
votes
0answers
18 views

How to keep directories sorted by interest or frequency of usage?

Current situation Let's say I have a cloud sync directory $CLOUD_DIR with sub-directories which I want to keep sorted by interest. In order to do that I use lexicographical order and use number to ...
0
votes
0answers
62 views

Find hidden directory under user profile and echo result

#!/bin/sh USERLIST=$(ls /Users | grep -v Guest \ | grep -v .localized \ | grep -v Shared \ | grep -v administrator \ ...
-2
votes
1answer
112 views

How to list all files and directories in current directory, whose Second character is a digit

What command is used to list all files and directories in the current directory, where the second character of its name is a digit. Can we use grep here?
1
vote
1answer
35 views

Perl opendir() only allows one operation?

I've found a strange issue with perl's opendir() function that makes absolutely zero sense to me. In the following example perl will open the directory specified by $path and pull out all of the ...
-1
votes
1answer
28 views

Removing files and directories inside an directory

In Unix,How to remove files and directories from the directory named as parent. The parent directory is placed inside grandparent directory.i need to remove only the files and directories inside ...
0
votes
2answers
42 views

Compare large directories recursively ignoring sub-directories - compare two backups - with gui

I've got 2 very old Backups of a friends computer. They were simply copied into a folder each on an external Harddrive. Both are about 300GB in Size and the contents are very much alike but not ...
4
votes
5answers
190 views

How can I sort a list of directories alphabetically and get the first value that sorts after a specific string?

I have a directory full of backup folders, with names in the format yyyy-MM-dd--HH:mm:ss If I enter a date in the same format, is there a way to get the first directory that sorts after it, and copy ...
0
votes
3answers
122 views

How do I tar all files without paths

I want to find all .c files in current directory and subdirectories and tar them. I try to use the following way to achieve this goal but when i unzip files, the files in different folders. I don't ...
-1
votes
2answers
52 views

What's the point of setting individual file permissions when no-one can access/view your user's home directory anyway?

So let's assume I have a file inside my ~ directory called "file.txt". My ~ directory (aka user) has it's permissions set to 700. Now, let's say my file has permissions set to 664, meaning I want ...
0
votes
1answer
288 views

Why rm gives warning when deleting a write protected file?

I have a regular file and I changed its permission to 444. I understand that as the file is write protected, we can't modify or remove the contents of file but when I try to remove this file using rm, ...
0
votes
2answers
49 views

Create files inside a directory with the directory's name

I'm using the following command to create a .m3u playlist in a directory with music: ls -1v | grep .opus > Playlist.m3u How can I automatically name the m3u-file after the folder?
0
votes
1answer
18 views

Making use of second (ext3) hard drive

I have two hard drives. Both are FireCudas, "half ssd, half hdd". One has 1TB of space and the other, with my Manjaro on it, has 480GB. Up until now (for 2 years) i have not used the second drive, ...
0
votes
1answer
22 views

shared home with Mac OS

I have ubuntu (actually pop_os) and mac os on my laptop. To not get it too messy, some of my folders like documents, movie, music are used by both systems. The problem I encounter is due to the ...
3
votes
2answers
57 views

How to move files in subdirectories older than x days?

Basically I want to do this: mv /path/sourcefolder/* /path/destinationfolder/ but only with files older than eg 90 days. MV has to copy the subdirectory structure of the source-path if necessary. ...
0
votes
1answer
43 views

Accidentally turned a file into a folder [closed]

So I was working on a python script that allows me to use a 7 segment display via scripting. I added functionality to read a byte from a string, presets for certain numbers, etc. It took me a solid 4 ...
0
votes
2answers
94 views

Move all files from subdirectories to parent directory

I have a directory structure like this: ├── Tom │   └── c │   └── 2 │   ├── file.jpg │   └── text.txt └── Sam ├── 1 │   └── c │   └── music.aac ├── E │   └─...
0
votes
1answer
47 views

Automated FTP Script Not Finding Source Directory

How could I modify the script below to include the source directory so that it will know which location to retrieve the files required for transfer? I have a bash script for the purpose of ...
0
votes
1answer
53 views

Move multiple files in folders with same structure

In a project I am working on, I originally had some directory named assets, with a large number of directories, whose names are not predictable, each of these directories contained a number of files, ...
1
vote
1answer
49 views

Why does find . not show all files

ls - list directory contents empty_dir# ls -al total 0 drwxr-xr-x. 2 root root 6 Dec 31 09:49 . dr-xr-x---. 6 root root 284 Dec 31 09:49 .. find - search for files in a directory hierarchy ...
1
vote
1answer
45 views

How to copy multiple files from one directory to another

I want to copy multiple files from one directory to another. I have a variable (files) that contains the following structure: file1 file2 File1 and file2 are in dir1 and I want to copy them to dir2 ...
0
votes
3answers
91 views

Quicker alternative to Linux Wipe Command for secure deletion

I am fairly new to Linux but all I can say is I love it!!! :D Anyways, I am trying to securely erase 1000s of files from my harddrive because new year is approaching and I want a fresh start to life. ...
0
votes
2answers
68 views

Awk for certain files in a directory

I have a directory called 'directory1' with files: file1, file2, file3, that have been passed by in a variable 'files'. Echo $files has the following output: file1 file2 file3. I want to have the sum ...
0
votes
2answers
54 views

Remove all duplicate files in subdirectories in main directory

I am new to Linux and was wondering how I would go about deleting all duplicates with same file name but only keep one original? For example I have the following: dir_new_001 = rdt.txt dir_new_002 = ...
3
votes
5answers
114 views

Moving all files with same file extension .txt to a new directory

Basically, my hard drive is a mess and I have like 200+ sub-directories in a main directory. I want to essentially move all files in 200+ sub-directories that have the extension .txt etc to a new ...
0
votes
0answers
26 views

How do I copy/move a directory with tons of content from EXT4?

So I have a Micro-SD card with an EXT4 file system on it. On there are a bunch of files that I used to save in this structure: /YYYY-MM/folders/files - The amount of files in the folders is usually ...
1
vote
1answer
20 views

How can I quickly create all folders named {Single|Multi}Lane_{Single|Dual}Carriageway_{USA|Europe}

In Bash or Zsh, what is the shortest way to create a folder for each possible combination of substrings? Is there maybe even a notation such as mkdir {Single|Multi}Lane_{Single|Dual}Carriageway_{USA|...
0
votes
2answers
39 views

Achieving the effect of a recursive rmdir

As far as I can see, rmdir might well have had the option -r, to remove the argument's reference only if it contained only directories and no file anywhere in the tree. What's the simplest way of ...
0
votes
2answers
52 views

Update merging two directories

First, note that this is not a plain 'merge two directories', this is a question about how to keep the merge of said directories updated when the sources change. Let us say that I have two ...
-7
votes
2answers
73 views

Creating directory structure

I have been given an homework assignment for Linux that reads: Create a tree of files as shown in the image in the user home directory(用户主目录), listing all the commands that complete the process. ...
0
votes
1answer
613 views

What is the right approach to purge /var/spool/abrt/

We want to automate the process of removing old directories from /var/spool/abrt/. We have RHEL machines - version 7.x. The known way is to do the following # systemctl stop abrtd # systemctl stop ...
0
votes
2answers
44 views

Find directory inside subdirectory using macOS terminal

I want to find a directory x inside a particular subdirectory y using the macOS terminal, but I do not know the directories preceding y. This command - find / -type d -name "x" works for finding x, ...
0
votes
2answers
31 views

How do I make a directory part of a group?

I created a directory and the next step is to make that directory part of a group. Is this down with chown? Or another command? This is for my schoolwork. We have gone over permissions and changing ...
0
votes
1answer
25 views

Give the permissions to modify files only for the owner in a specific directory

I have 4 users: A, B, C, D and a directory : folder10; I want to give A and B acces to folder 10, and whenever someone create a file in this folder, he will be the only one who can modify it, the ...

1
2 3 4 5
30