Questions tagged [directory]

A file system structure in which to store computer files.

Filter by
Sorted by
Tagged with
1 vote
2 answers
81 views

Delete directory and create new one with same name and permissions [closed]

I want to delete a directory with its contents recursively, and then re-create it with the same name and permissions. That directory may or may not be created or owned by me earlier before delete, but ...
Vicky Dev's user avatar
  • 259
0 votes
0 answers
20 views

Why error "Could not paste files" in copying directory to external hardrive?

I get this after tying to copy directory to the external usb disk Samsung T7 Shield: I by accident removed the harddrive without unmounting correctly. After it, it do not allow me to copy directories ...
Léo Léopold Hertz 준영's user avatar
0 votes
1 answer
29 views

Why do "force create mode" and "force directory mode" parameters exist in smb.conf?

I am reading How to Set Up a Network Shared Folder on Ubuntu With Samba. At the "Step 2: Configuring Samba" section the following configuration is given: [sambashare] comment= Network Shared ...
Manuel Jordan's user avatar
3 votes
3 answers
221 views

How does the d option for the ls command exactly work? [duplicate]

Having the following simple structure: project main aaa aaa test ddd ddd pom.xml <--- unique regular file If the current directory is project and if is executed the ls command ...
Manuel Jordan's user avatar
0 votes
0 answers
65 views

Ubuntu - trying to delete a file that has no inode

I try to delete a file that is left in a directory, but even an ls -i will not give me an inode to remove it. Deleting/removing the directory won't work even with the inode. $ ls -ila ls: cannot ...
merkc's user avatar
  • 1
0 votes
0 answers
22 views

Deleting an entry from the ext2 directory entry list

From this question, which references this site, I understand that when an entry in a directory is deleted, the size of the previous entry is pushed to the next entry or to the end of the block ...
Mora's user avatar
  • 1
0 votes
1 answer
107 views

What is . and .. in Unix/Linux? [duplicate]

What is . and .. in Unix/Linux ? I’m making a confusion here: the .. (dots) means one dot for the current directory and one dot for the parent directory? That why cd .. goes back one above? From the ...
Guilherme Woolley's user avatar
2 votes
0 answers
37 views

"No space left on device" depending on alphanumeric filename, adding or removing a character works [duplicate]

I just encountered this most curious of errors: $ touch 3a59199733b83a8dba88b48c3f3c6fac05699ea8f1dd5ef7540ee57d64896d6d touch: cannot touch '...
Nobody's user avatar
  • 539
0 votes
0 answers
68 views

Why can't my linux system find my home directory when logging in to the shell?

I recently formatted the home partition on my server and manually created some of the users' directory to it. Since there were too many users on the system, I only created the users directory that are ...
Theonlykim's user avatar
3 votes
3 answers
119 views

Rename directories by removing part of a dir name

Have lot of directories like the following ./parent/inventory_control-8118c470fa3811ed9add1fef7e5ef70f/snapshots/automation ./parent/configuration_data-6be54fa0fa3e11ed9add1fef7e5ef70f/snapshots/...
Saravanan's user avatar
0 votes
0 answers
47 views

How to disable root account on MacBook Pro if I don't know root password

I bought a used MacBook Pro 2017 from a reseller but I found restrictions in accessing many places. Then I realized this machine is already configured with a root user which I don't even know. How ...
abby rj's user avatar
-3 votes
2 answers
98 views

What subdirectories of a user's home directory does the user have full control over?

What subdirectories can a user create in his or her home directory ~ with the intent (and reasonable expectation that the intent will be honored) that only that user have write priviledges? For ...
Ana Nimbus's user avatar
0 votes
1 answer
125 views

Any command to exclude all types of files only? [duplicate]

Does rsync or cp have a command to exclude any type of file besides manually excluding extensions such as *.txt, *.pdf, *.jpg OR setting -maxdepth or using --exclude=dir/* (used with rsync which ...
anmac1789's user avatar
0 votes
1 answer
84 views

find & cp command doesn't copy 1st level directory

I have a directory structure like this: test folders ├── 1 │   ├── 1-1 │   ├── 1-2 │   └── 1-3 ├── 2 │   ├── 2-1 │   ├── 2-2 │   └── 2-3 ├── 3 │   ├── 3-1 │   ├── 3-2 │   └── 3-3 └── 4 ├── 4-1 ...
anmac1789's user avatar
1 vote
0 answers
29 views

How to merge the content of multiple subdirectories into another directory where destination contains the same directory name using a mount / union?

In the example below, exdir is a directory containing many subdirectories. The contents of each subdirectory, which are directories themselves, should be merged with /su/destdir, which already contain ...
Dr. Barry's user avatar
0 votes
0 answers
37 views

rsync synchronising a sub-folder while respecting the original folder exclusion rules

I have a bash script which synchronises a source folder to a destination folder in the presence exclusion rules. something akin to rsync -l -a -no-g --delete --exclude $PATTERN $SRC $DST I would like ...
Serge's user avatar
  • 121
-1 votes
1 answer
49 views

Locating the "media" directory in the home directory on Ubuntu

I need to find the "media" directory somewhere in the home directory. I can't see it as a directory or sub-directory.
fredtheoctopus's user avatar
1 vote
5 answers
495 views

How to find missing directories between two disk structures?

How to find missing directories between two disk structures? Lets say Disk A has dir A/, B/, C/, D/. (newer copy) Lets say Disk B has dir A/, B/, D/, E/. (older copy) I want to find which ...
Estatistics's user avatar
1 vote
4 answers
93 views

Checking if there's a file with a particular name in a lot of directories

I'm new to Linux, but I'm wondering if this is possible: I want to check if a directory has a file with a .bam filename suffix, and there are hundreds of directories to check. I don't really want to ...
Eric Zheng's user avatar
1 vote
1 answer
57 views

Change the last modification time of subfolders to that of the oldest file inside

Hello I would like to know how to scan and change the last modified date of all subfolders based on the oldest file in each subfolder. Example of Ubuntu folder structure: home/incoming/media/Something....
Loop1's user avatar
  • 21
0 votes
3 answers
83 views

simple question regarding moving files and folders

I am a noob, gains are slow. working on moving things around, playing. Command: mv man-pages(man-pages folder) /bob. instead of moving the man-pages folder(directory?) to directory bob, it took all 10 ...
bryce colwell's user avatar
0 votes
0 answers
41 views

understanding the /sys directory [duplicate]

I'm not understanding whats inside the /sys directory. Is it just a more organized version of /dev? Chatgpt is telling me that: The /sys directory in Linux is a virtual filesystem (sysfs) that ...
Mathew's user avatar
  • 235
2 votes
3 answers
141 views

Unmount all nested directories under path

Let's consider these conditions: There's multiple nested mounts with a lot of folders/files in /mnt: sdb 8:16 0 300G 0 disk ├─sdb1 8:17 0 256M 0 part /mnt/1/1 ├─sdb2 8:18 0 199....
GrabbenD's user avatar
  • 126
0 votes
0 answers
35 views

Folder to a mounted media device issue: target is not a directory

I’m installing GitLab using this command sudo cp /var/cache/apt/archives/*.deb /path/to/mount and it is throwing this error: cp: target '/path/to/mount' is not a directory What is the problem?
chandru lovely's user avatar
0 votes
1 answer
54 views

How to merge all folders in one directory without merging their subfolders?

I have folders arranged as such: Directory -Subdirectory A 1 --Subdirectory B 1 --Subdirectory B 2 -Subdirectory A 2 --Subdirectory B 3 --Subdirectory B 4 How do I merge all the Subdirectory As into ...
eldomtom2's user avatar
0 votes
0 answers
219 views

Error opening directory with Okular due to "Too many levels of symbolic links" in Ubuntu 22.04

This location could not be displayed. Sorry, could not display all the contents of "Documents": Error opening directory '/home/arijit/Documents': Too many levels of symbolic links I ...
ARIJIT GURIA's user avatar
0 votes
1 answer
87 views

Rename directory hierarchy

How can I rename directory hierarchy? For example I want to rename c/d to x/y There won't be necessary only 2 folders. So the full directory path /a/b/c/d/e becomes /a/b/x/y/e after the operation. Not ...
ka3ak's user avatar
  • 1,265
0 votes
1 answer
149 views

Symbolic link on Linux to a Windows-like file - not sure this is possible

I have to migrate a Windows application to Linux. The directory/filename format within this Windows application are of the form C:/dir/dir/file (I know, not exactly Windows format with reference to ...
tale852150's user avatar
0 votes
1 answer
109 views

Which first level directories in Linux should be owned by user?

Today, I have accidentally noticed that the following directories of the / are owned by user, rather than root: /home /lost+found /media /mnt /opt /snap /srv /swapfile /var I have no idea how that ...
S. N.'s user avatar
  • 287
0 votes
1 answer
88 views

cp AND rsync exclude all files of all types from all subdirectories, only keep directories [duplicate]

when using find . -type d it excludes all files whether in parent directory or in subfolders from the search. I want to extend this into a -exec cp -p or rsync "{}" destination \; so that ...
anmac1789's user avatar
2 votes
2 answers
89 views

Why can't Darktable see my image folder?

I recently added a new SSD hard drive to my machine (the specs of the machine are here to use for my photography. I mapped the hard drive (this is on ubuntu) to the /archive folder and everything has ...
Joe's user avatar
  • 131
0 votes
0 answers
70 views

Not a directory but have contents

So I use Compute Engine VM in Google Cloud to download youtube videos. I use Youtube-dl to download it. I follow the documentation in here: https://github.com/ytdl-org/youtube-dl/blob/master/README....
Flitzcore's user avatar
0 votes
1 answer
91 views

How to iterate through directories of zip files and locate & append files without a .zip extension

I have a directory of sub-directories that contain sub-directories which are supposed to be compressed archive files. Structure is illustrated below ParentDirectory |-SubDirectoryA |-File Mr X.zip |-...
McGooks's user avatar
0 votes
1 answer
39 views

Iterate sub-directories and zip files with same prefix and remove original files after compression

I have the current code: for fname in *.*; do prefix=${fname%.*} [ ! -f "$fname" ] || [ -f "$prefix.zip" ] && continue zip "$prefix" "$prefix&...
McGooks's user avatar
1 vote
0 answers
39 views

eCheck if it's safe to move a directory and replace it with a symlink

Say the directory you want to move has absolute path DIR. A case where it is NOT safe: that directory has either absolute path symlinks to within DIR itself. For instance DIR/link -> /PATH/TO/DIR/...
extremeaxe5's user avatar
  • 1,183
1 vote
1 answer
82 views

Make directories executable

How may I add execute permission to all subdirectories of the current directory for the owner, the group owner, and all other users? Regular files should not be changed.
John Akech's user avatar
0 votes
1 answer
62 views

Find files with matching substrings and move them into directory

My directory contains a list of .idat file pairs ending with either _Grn or _Red. For each pair, I want to create a directory named after the substring before the first _ delimiter and move the files ...
Anon's user avatar
  • 133
-3 votes
2 answers
84 views

Where in Ubuntu . or .. is defined as current directory or parent directory and how I can add my own ...?

I was reading this question and started wondering what exactly .. and . that we can see in every directory means and how I could potentially add my own ... that could mean for example parent of my ...
Arek Kubiński's user avatar
0 votes
0 answers
29 views

Cannot open files in texlive directory

I've installed texlive 2023 via tlmgr, the directory is /usr/local/texlive/2023/ and update it with sudo tlmgr --self --all --no-auto-remove update as I've been doing it for years. It works perfectly ...
Alexander Wittmann's user avatar
5 votes
4 answers
687 views

Copy the n-largest files from a certain directory to the current one

I am trying to copy five largest files from a certain directory to my pwd. Using cp specific/directory$(ls -S specific/directory | head -n) ./ copies the first file and then proceeds to produce cannot ...
Sudoh's user avatar
  • 257
0 votes
1 answer
69 views

Empty folders without changing folder's Last Modified Date

I wish to delete the contents of around 600 folders on my Linux Mint PC but I want to retain the Last Modified Date of the top-most folder as it existed before deleting the files. This would be ...
Mister Chuff's user avatar
1 vote
1 answer
41 views

conflict between bash and its auto-completer on the meaning of .. for symlink to directory

In my home directory /home/regis, after creating a symbolic link LINK to directory DIR/SUBDIR, and doing cd LINK, I have a conflict between bash and its auto-completer regarding what .. leads to. For ...
Regis's user avatar
  • 13
15 votes
4 answers
1k views

Why doesn't read permission on directories reveal inode numbers?

As far as I understand, the "read" permission on directories allows one to list all names under that directory, and no more than that. Based on common understanding of FS design, if a ...
iBug's user avatar
  • 3,528
1 vote
1 answer
79 views

Remove entire folder when grep find no files with a match inside the folder

I have thousands of folders with a single html file in each folder. I want to remove the entire folder if grep find no match to example.com in the html file. I know how to remove the non matching file....
xorghelpneed's user avatar
2 votes
3 answers
3k views

How to loop through all the files in a directory and print all the file names, like the command tree

How can I mimic the tree command and iterate through all the files and subdirectories of a directory and echo all the file names? I thought that a subdirectory within a directory is still counted as a ...
John Smith's user avatar
1 vote
1 answer
52 views

Is there a generic term for working with files and directories?

I was wondering if there is a generic term that describes working with or manipulating files and directories that includes all the different ways of manipulating files? Similar to the term coding that ...
t800's user avatar
  • 13
0 votes
1 answer
26 views

How can numbered files be moved and renamed to subsequent numbered files to correct directory?

In ~/wrongdir there are mpv-shot0001.jpg, mpv-shot0002.jpg, mpv-shot0003.jpg, mpv-shot0004.jpg, mpv-shot0005.jpg where the screenshot key was pressed when a mpv was initiated in ~/wrongdir. The ...
Digit's user avatar
  • 391
-1 votes
1 answer
110 views

Empty directory with specific size

How to create an empty directory /tmp/empty that is at least 20MiB in the filesystem. I tried to create a file and delete it, but the size of the directory was not saved. i think that might help i ...
jano's user avatar
  • 1
4 votes
3 answers
2k views

How do I delete files with the same names in multiple sub-folders from the command line?

I have a folder called simulations, which contains 101 subfolders. These sub-folders are named posterior_predictive_sim_1 to posterior_predictive_sim_101. Each subfolder contains five files: seq.nex, ...
Namenlos's user avatar
  • 141
0 votes
1 answer
120 views

Move all the file present in a directory with same letter/word in them to another directory

rda@MacBook-Pro X.WORK % ls Assignment1.file Sec3 moremumbo.woot FICTION.bak Test-1.bak mumble.txt File-1.bat Test-1.txt mumbo.file FundaOfIT.txt Text-1.xtxt ...
matt's user avatar
  • 1

1
2 3 4 5
36