Questions tagged [directory]

A file system structure in which to store computer files.

Filter by
Sorted by
Tagged with
-1
votes
2answers
111 views

Using .. and . to copy files from dirctories

I'm trying to copy a file from the home directory to the current directory( which is a subdirectory of a directory in home) using .. and . instead of path names or ~ This is what I tried, but it ...
-1
votes
2answers
2k views

bash: cd: <path> : No such file or directory [duplicate]

I upgraded to the latest version of Kali Linux and all of a sudden I can't open up files. The file manager shows the files exist and I can get in them through the file manager but cannot do so through ...
-1
votes
1answer
1k views

Find files in specific directories

I have a college exercise which is "Find all files which name ends in ".xls" of a directory and sub-directories that have the word "SCHEDULE", without using pipes and using only some of the commands ...
-1
votes
2answers
1k views

How to make tar create a folder if it doesn't exist when creating archive

Does tar have any option where, when creating an archive, if the target directory does not exist, it creates it on it's own? So I got folders /1/2 but I don't have folder /1/2/3/. Is there any option ...
-1
votes
2answers
434 views

Find and rm command deleted the files inside the directory and the directory itself

Can you please check this command? It's deleting the files and the current directory itself. Script is run via cron. Directories: /log/dir/ /log/dir/tmp/ Commands in script: find /log/dir/ -mtime +...
-1
votes
2answers
50 views

Unable to remove directory?

I am unable to remove a directory named like this: \034\000\000,?IS?#\001\000 Tried with rm "\034\000\000,?IS?#\001\000" with no luck. How can I delete such a directory?
-1
votes
1answer
472 views

recursively compare the contents of 2 directories in CentOS 7

A build process in an app is generating a directory structure in a CentOS 7 machine. I have copied the app to a second location in the same server, made a few changes, and then run the build process ...
-1
votes
1answer
374 views

On a OS X machine, how can remove a directory that has name “--crm”? [duplicate]

I am trying to remove a directory that has the name --crm. When I do rm -f -R '--crm' I get the following error: rm: illegal option -- - usage: rm [-f | -i] [-dPRrvW] file ... unlink file I ...
-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 ...
-1
votes
1answer
81 views

Unix directory for all users permissions

I'm trying to make a directory where all users can write, but no user can delete another users file in that directory.
-1
votes
1answer
37 views

file -b command return on sticky bit files

I am trying to understand why the file -b command is returning a certain value(s) when the sticky bit is set. When I run file -b <dir> where dir has its group set to g+wrs, file -b returns ...
-1
votes
3answers
76 views

Mv several file to directory with same basename

I have several files with different extensions and directories with the same basename, like this example. FileA.txt FileA.html FileA.directory/ FileB.txt FileB.html FileB.directory/ FileC.txt FileC....
-1
votes
1answer
64 views

how to protect the directory using password in LINUX (Need to add or modify files after encrypted )? [duplicate]

Is there any possibilities to protect the directory using the PIN number in Linux. But we need to add or modify files inside the encrypted directory.
-1
votes
1answer
288 views

Shortening of DB and WordPress instance creation script

How could I further shorten the following script who's purpose is to create a database && WordPress instance and then change permissions per the domain given and restart the server? ${domain} ...
-1
votes
1answer
595 views

ls command in a variable to display in dialog checklist and processing of the selected option

i just started shell programming and i can't get the following problem to work. I want that all directorys, from a defined directory (e.g.. /var), are displayed in dialog checklist. I also want that ...
-1
votes
1answer
1k views

How to extract file from tar.gz archive to different directory in bash [duplicate]

I have tar.gz archive on external drive and to extract I need to copy to my home directory and then extract. Is there a way to have it in one go, extract to /home/me directory without the need to copy ...
-1
votes
1answer
413 views

Sub Directories in sub directory using loop

On my CentOS machine, I need to create a main directory inside which I will have a few sub directories and, inside them, some subsubdirectories. Something like: main_directory->sub1,sub2,sb3.. ...
-1
votes
1answer
293 views

Hyphen/Dash “-” Symbol's use in Linux bash /dir + GRUB booting

I am attempting to complete this GitHub tutorial on creating a custom GRUB loader for a stubborn Asus Win8.1 laptop on which I am hoping to install Ubuntu: https://github.com/lopaka/instructions/blob/...
-1
votes
3answers
332 views

How to change dir to the last directory? [closed]

I have very long directories list, like /dir/dir/dir/../../../../../../../../../.. ../../ ../../last dir Is it possible to change to the last dir immediately?
-1
votes
1answer
131 views

Unnest directories that have same name [closed]

I have too many files being in directories with same name EXAMPLE: ~/foo/bar/foo/bar/1.flac ~/foo/bar/foo/bar/bar/foo/foo/0.flac I want to have ~/foo/bar/0.flac ~/foo/bar/1.flac
-1
votes
1answer
486 views

Select a range of files from directory structure /year/month/date.db

I have databases stored in the directory structure year/month/date.db an example would be db/2013/10/15.db I need to be able to select a range of these with a script ("dbSelect 2013/09/01.db ...
-1
votes
1answer
62 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,...
-1
votes
1answer
49 views

How to switch to the last added folder in that particular folder in S3 bucket

I have a **S3 bucket in which starting of every month ... will be added. And in the month lder daily **new files will be added .
-1
votes
1answer
259 views

Permission needed to create/remove file in a directory with sticky bit set

I understand that creating/removing a file from a directory with sticky bit set requires one of the followings you are root you are the owner of the file you are the owner of the directory and you ...
-1
votes
2answers
260 views

TAR: multiple directories in a bash script

I am trying to TAR files within 5 different directories that are less than 7 days old. Using the find command, I can find the files that I need to TAR after I use this: find /opt/splunk/var/lib/...
-1
votes
2answers
126 views

Compiling c/cpp files in a directory given as an input

I need to write a script called DirCompile that receives a directory path as a command line argument and compile all the c/cpp files. for example helloWorld.c file will be compiled into helloWorld....
-1
votes
1answer
797 views

How to set the owner of tar files and its contents to current user

I need to set the owner of tar files and its contents to be set as current user. I will receive files from user FOO in the folder config_files/billing/xml/incommingBills i want to set owner as ...
-1
votes
2answers
118 views

How to avoid a variable containing a list of directories being treated as string [closed]

#!/bin/bash Dir='/home/TEST' Project="${Dir}/Project.txt" The text file Project.txt contains the file type & its path: SOURCE|FILE|TARGET_PATH TEST|BDL|/LOAN/NDL/XML TEST|BDL|/LOAN/DL/XML TEST|...
-1
votes
2answers
92 views

How can the number of files in a directory be determined by viewing “ls -ld” output? [duplicate]

The command has to be ls -ld Just from viewing the output of this, how can I determine how many files are in this directory?
-1
votes
1answer
80 views

finding specific directories

I need to find all directories that begin with dirD in the directory /dirA/dirB/dirC. Basically, dirD*. So far I tried: find . -type d -name "dirD*" and ls -lrt | grep "^d" | grep "dirD*" Now I'm ...
-2
votes
2answers
947 views

Why does Linux not allow deletion of read only directory? [closed]

I am new to Linux. When I make a file as read only I am still able to delete that file. I read on the net that deleting a file depends upon the permissions of the folder in which it lies. To make ...
-2
votes
1answer
684 views

Move folder from root of Hard Disk to Current Directory [closed]

I'm trying to figure out how to move a folder that sits in the root of my disk (what do you call that, home?) to a subdirectory. I am not cd'd to the root (again not sure of the terminology). When I ...
-2
votes
1answer
1k views

Not able to cd into folder in Linux machine. Says file/folder does not exist

I have written a test ksh file to cd into a folder and do a listing. Following is written: `cd "their_file/"`; `pwd`; `ls -l`; Gives me following output: ./test.ksh: line 2: /home/user/final: Is ...
-2
votes
1answer
37 views

How can I get back to directory line from the MySQL line?

I’m not sure exactly what I did, but I entered into MySQL and now I cannot return to the directory line. How can I leave mysql> cd .. and return to debian@beaglebone:/home$ cd ..
-2
votes
2answers
948 views

Getting a propmt when deleteing a non-directory

I want to get a prompt when attempting to delete a non-empty directory with rmdir. Is this possible?
-2
votes
1answer
34 views

Setting directory permission to 0570 [closed]

There was an answer to "Execute vs Read bit. How do directory permissions in Linux work?" regarding setting a directory permission to 5 (-R-X) value. It was said it "5: Allow reading / writing, but ...
-2
votes
2answers
109 views

Is this good in order to have an empty directory?

I would like to have a directory mydir with empty content, but I don't know in advance if it already exists, or when it does, if it is empty. So my way is mkdir -p mydir ...
-2
votes
3answers
940 views

How to tar zip directories which are 7 days older

I have a folder that contains a lot of xml files stored in it, the folder name has a format 'yyyymmdd' eg., 20180515. I wanted a script that can zip the folder of this kind, when the folder grows 7 ...
-2
votes
1answer
67 views

How 'Desktop' Directory Works [closed]

The desktop seems to pretend to be a snapshot of a file explorer where you can access the contents of an actual directory. I think it would be nice to be able to make it less static where the ...
-2
votes
1answer
79 views

How to get files from broken directory? [closed]

I created some files and directories on external NTFS HDD using Ubuntu. Some folders displayed with cross sign, I changes permissions for them (777), now they just as a files. Copying of directory ...
-2
votes
1answer
4k views

How to take a directory or file backup using command? [closed]

I have uploaded my file there will be a daily changes in that file for safer side i want to take backup that directory,when i tried copy that folder to another it is showing whenever i have created ...
-2
votes
1answer
58 views

viewing actual file size of folder

I know that the command du -csbh will show you the actual file size of a directory. This will be displayed as: 241 MB which is fine. If I look in windows 10 at the properties of the same folder. The ...
-2
votes
1answer
259 views

Find part of filename

Please help with my task: I have a folder with three sub-folders containing six files each. There are two files in each sub-folder with :nopm in their file names. I need to create a shell script ...
-3
votes
3answers
94 views

Ensure I am a in specific folder before calling rm [closed]

in my bash script, I have some very danger lines like : rm -r * if it is mis-run in some folder, it would be very disastrous.Basically, I would need to add an if condition to make this does not ...
-3
votes
2answers
36 views

In what cases may some programs require you to run them on a specific directory? [closed]

https://unix.stackexchange.com/a/76641/674 Create a short shell script to run your wine program in this directory, i.e. ~/bin/textaloud: #!/bin/bash cd "~/.wine/drive_c" exec wine "~/.wine/...
-3
votes
1answer
868 views

cd command does not work in my shell script

I have a script .sh that creates a directory and moves to this directory some files. I want to change the directory to this new one just created, but it doesn't work with the command cd ./$dirname1$...
-3
votes
1answer
69 views

Arrange for files created in a directory to belong to the directory's group

How do I set permissions so that whoever creates any files or directories in /directory, the group owner should automatically be the same group owner of /directory? This is on RHEL.
-3
votes
1answer
5k views

tar (child) : Cannot open: no such File or Directory [duplicate]

i was trying to install netkit on kali linux with the following standard commands mentioned on netkit.org commands: Download all the files to a directory of your choice. Then unpack them by using the ...
-3
votes
1answer
873 views

curl to stdout and untar a zip to a specific directory [duplicate]

What is the correct way to curl to stdout, then untar (a zip file in that case) to a specific directory? This failed: curl URL | tar -x > /path So I thought of this which also failed: curl URL ...
-3
votes
1answer
58 views

How to create copies of a directory with sequential numbers

I have a template directory containing sub-directories and MS-Windows links. This directory needs to be sequentially reproduced at the same folder level. The range needs to be from one to twenty. So, ...