I have a directory structure as :- I want to keep the public folder and all its contents (further folders and files within it) but want to delete everything else under the directory /usr/testing/member/. But that also means member folder is not deleted. Is there any shell script or command that can be used to achieve this exactly as i
Tag: directory
Making new directories with a Bourne Shell script
I am am new to Linux and have a question about scripts. I am interested to know how you create a new directory and copy all the files (with .txt extension) from the existing directory into it? I am familiar with the mkdir method but I am having trouble when trying to execute it within a script. I have tried
The directory is being deleted too early
I’m trying to create a tar file from a directory’s contents using Codec.Archive.Tar, but I also want to clean up the directory once the tar file has been created. Here’s a small example which demonstrates my issue: When I call the function listFile e.g. from within ghci, I get back which I’m guessing is caused by the tar file being
Is using chdir() the only way to change the working directory in Linux C?
I have been given an assignment where I have to build a custom terminal using ncurses and C, and implementation of several commands is requested. One of the commands happens to be chdir, which is meant to change the working directory, however I could not find anything more relevant in C when it comes to changing the working directory besides
linux command line recursively check directories for at least 1 file with the same name as the directory
I have a directory containing a large number of directories. Each directory contains some files and in some cases another directory. I need to check that each sub_dir contains at least one file with the exact same name. I don’ need to check any further down if there are sub directories within the sub_dirs. I was thinking of using for
Is there a quick method on linux to switch to recently accessed n folders (n > 1)?
We can use cd – to access the most recently accessed folder, but what if I want to quickly switch to the last but one folder accessed? Answer Sure there’s a way! You want the shell builtin pushd.
Linux: Loop using foldername when finding file
I’m currently trying to use the following linux script to loop through folders and perform calculations using a function: The problem: How can I use the foldername to find the correct file? For example, the foldername is scan1 and I want to use the file called gaf_scan1_recording_mic.nii for the function. Thanks a lot, Eric Answer In most cases, $var and
Move all files at one level up one level
I had a problem with a backup on a linux server that somehow moved all folders of files down one level into a new folder with the same name. I would like to return all files to their original location. Many of the files have spaces in their names to complicate things. Original directory structure: Incorrect directory structure: Note that
error while running SOLR application
i am newbie on SOLR, i want to start my SOLR via terminal ubuntu but it always give error message : tail: cannot open ‘/var/solr/logs/solr.log’ for reading: No such file or directory i try to use this script service solr start and ./solr start but the result still same, any idea to fix this problem? Answer I fixed this increasing
Copy file only after all directories are copied
I have a folder A. It contains another folders data and opt, which contains many folders and files. And a complete.txt file, which denotes all files in data and opt are correct. I need to copy folder A completely. But the complete.txt file should copy only after all other files and folders are copied. Is there any linux command to