Skip to main content

All Questions

1 vote
3 answers
1k views

How to find if a directory is having a symbolic link as well with any other names

lrwxrwxrwx. 1 oracle oinstall 10 Oct 14 03:47 abc -> xyz drwxr-xr-x. 6 oracle oinstall 4 Oct 26 21:11 xyz i want to find that xyz is having a symbolic link with name abc
user avatar
7 votes
3 answers
1k views

Find all directories that contain only hidden files and/or hidden directories

Issue I have been struggling to craft a Bash command that is able to recursively search a directory and then return the paths of every sub-directory (up to a certain max-depth) that contains ...
BitWrecker's user avatar
-1 votes
2 answers
2k views

Shell script to check file name with two extension and if file with both the extension are present call a script otherwise it should fail

I need to check a file with two extensions (.txt and .ctl) in a directory and if file is present with both the extensions call a script. If not the job should fail. I tried some methods but it is not ...
Asna's user avatar
  • 1
0 votes
0 answers
766 views

Bash: remove spaces in directory name [duplicate]

!! This question is not about SHELL, it's about BASH, can't change the faulty tag !! I've got a code that removes the spaces in directories and filenames (and inserts a dot); find $jdir -depth -name &...
JoBe's user avatar
  • 417
0 votes
1 answer
611 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.,...
johnnywatts's user avatar
2 votes
2 answers
655 views

find: exclude n different directories and m different files present at any level but include few files from some excluded directories

I want to recursively find all directories and files inside a path but want to exclude some other directories and files that match given patterns. I then want to execute further commands on the search ...
HarshvardhanSharma's user avatar
2 votes
3 answers
5k views

using sed to replace a string in files which are in different folders

I have a file which is placed in different folders(with file extension .mvw). I want to write a script which goes to each folder and replace a string(in the file *.mvw) "D3PLOT_1DForce" with the name ...
Pavan Raj Singh's user avatar
0 votes
1 answer
891 views

finding folder name recursively and assigning it to a variable

I am in a folder path. There is a folder named dir. There is one more folder inside dir but I don't know the name. How to find it and assign it to a variable. PS: I want to run this on multiple ...
user3269839's user avatar
3 votes
1 answer
9k views

checking if a folder exists in certain directory

Hi I am currently working on a shell script project and I need to check if a folder, say "cat", exists in a certain directory. Right now I am using the find . -type d command, but what if the certain ...
ChocoLovie's user avatar
0 votes
2 answers
58 views

Delete all other undefined directories

I need to create a purge script to remove any foreign directories from a specific list of directories. My idee was to do something like this : #!/bin/ksh find /data/${USER}/SAS/ -type d ! -name '...
Fosfor's user avatar
  • 3
4 votes
5 answers
3k views

Find a specific file in the nearest ancestor of the current working directory

I'd like to find a way to find a given file by looking upward in the directory structure, rather than recursively searching through child directories. There's a node module that appears to do ...
iconoclast's user avatar
  • 9,362
0 votes
1 answer
124 views

Folder research task

I have a folder with 3 subfolders containing 6 files each.There are 2 files in each subfolders with :NOPM in their file names. I need to create a shell script that checks all the folders and their ...
KisPogesz's user avatar
3 votes
1 answer
2k views

Exit bash when find gets to a folder with permission denied

I'm trying to write a Bash script. Where I go through folders recursively and make a list of and count files and folders. In a way it works but if "find" gets to a directory where it has permission ...
Darkyere's user avatar
9 votes
3 answers
7k views

How to remove space in all sub directories in shell script?

I tried following shell script to remove all spaces with underscores: find $1 -depth -name "* *" -print0 | \ while read -d $'\0' f; do mv -v "$f" "${f// /_}"; done If I have a directory /home/user/g ...
krishna's user avatar
  • 529
6 votes
3 answers
2k views

Find files in directory with paired names

I'm running tests of a variable-size-and-contents test set. Data files are added and removed frequently. I'm looking for an automated way of gathering a file list. All files are in subdirectories of ...
Gaminic's user avatar
  • 163

15 30 50 per page