General :: Create All Subdirectories Of A Path?

Dec 9, 2010

Is there an easy way to create all subdirectories of a path in linux ?

Something like

mkdir /a/b/c/d/e/f

executed in / should create directories a,b,c,d,e,f

View 2 Replies


ADVERTISEMENT

General :: Move A File To Some Path And Create That Path When It Doesn't Exist?

Oct 8, 2010

I use this command:

Code:

find ./ -atime +360

to figure out the files that haven't been accessed since 360 days. The command above will return results like this:

Code:

/uploads/2010/02/some-file-name.ext
/uploads/2009/08/another-file-name.ext
... etc

I'm taking here about tins of directories, thousands of files. I'm looking to find a command that makes me able to move the results above to another path, and to create that path once it doesn't exist like below:

Code:

mv /uploads/2010/02/some-file-name.ext /old-files/uploads/2010/02/some-file-name.ext

But I want the executed command to create this path

Code:

/old-files/uploads/2010/02/

If it doesn't exist.

View 6 Replies View Related

Fedora :: Add X And All Subdirectories Of X To PATH?

Jun 24, 2010

Is there a way in .bashrc to say, instead of "add X to PATH, add X/Y to PATH, add X/Z to PATH", simply "add all subdirectories of X to PATH"?

[code]...

View 4 Replies View Related

General :: Find Files In Subdirectories And Copy Them To Another Directory With The Same Subdirectories?

Nov 18, 2010

This question is very similar to this one except that I want to maintain the file's original subdirectories.

For example if I had

/temp/a/a.txt
/temp/a/a.jpg
/temp/a/b.txt
/temp/b/c.txt
/temp/d/d.txt
/temp/d/d.jpg
/temp/d/e.txt
/temp/f.txt

[Code]...

View 2 Replies View Related

Server :: Create SUBdirectories In Dovecot?

Jun 19, 2011

I wonder how i can get subdirectories (.INBOX/***/*** etc...) in dovecot.I just stardet a mail server and when i tried to create it from the mail client (MS Outlook) it says that the server wont allow it.

View 4 Replies View Related

General :: Unable To Create A File In Specified Path In System / Enable This?

Jun 8, 2011

I am unable to create either a file or a directory in a specified path in Linux.
I am getting the error "No space left on device".
I have checked with df -k and df -i. Free disk space is 28 % and free inodes are 28 %.
What else could be the reason?

View 2 Replies View Related

General :: Difference Between PATH=$PATH:$1 & PATH=$1:$PATH?

Jan 16, 2011

I found the following function in /etc/profile file.

[Code]...

1. I dont undestand what "if ! echo $PATH | /bin/grep -qE "(^|:)$1($|:)"" this if statement actually comapres??

2. Also what is the difference between PATH=$PATH:$1 & PATH=$1:$PATH

View 14 Replies View Related

General :: Forcing An Absolute Path Where A Relative Path Is Expected

Feb 21, 2011

I have a program that takes a relative path as input appends it to a some path string to get the actual path.

Now all I can input is the relative path. So if I want to go one level above my input will be ../mypath.

If I know the depth of the path used internally, I can use .. as many times to go to the root directory and then give the absolute path. But suppose I do not know the depth of the directory, can I construct a relative path string such that it considers it as a relative path. One way could be to have enough .. in the path string so that I can force an absolute path for some maximum depth of path.

Is there some path string syntax that I am not aware of but can achieve this?

View 2 Replies View Related

General :: Deleted Path Variable - How To Return To The Original Path Value

Apr 26, 2011

Experimenting with shell variables, accidentally deleted the path variable how could I return to the original path value. What kinds of problems will I have if I don't have a path variable.

View 3 Replies View Related

Ubuntu :: How To Create Path Statement

Aug 7, 2011

I have multiple drives and software that defaults to my primary drive. I want to change preferences to use my second drive.This is the current path "/home/guy/dvdrip-data" my second drive is named "2Internal".How do I properly format the path statement to use the second drive?

View 7 Replies View Related

General :: Change Windows Path To Unix Path?

Sep 14, 2009

I have a path c:windowsackup I need this string to be changed into /windows/back/up I used the command -bash-3.00$ echo windackup | sed 's/\//g' but the output is windbackup

View 7 Replies View Related

General :: Change Absolute Path To Relative Path?

May 31, 2011

Current script:-

prefix=user@my-server:
find . -depth -type d -name .git -printf '%h�' | while read -d "" path ; do (
cd "$path" || exit $?

[code]....

How shall i go about changing the absolute path to relative path, so that /home/git/mirror/android/adb/ndk.git gets converted to /mirror/android/adb/ndk.git //echo <command> "$prefix$PWD.git" ?? - anything for relative path?

View 7 Replies View Related

Software :: Rpmbuild Does Not Create Lib64 In Correct Path?

May 13, 2011

I am trying to install OpenCV2.2.0 from the sources and to make it easier in the future I want to create a rpm on my OpenSuse 11.2 x86_64 platform. The instructions how to install are in the specfile The relevant parts of the specfile below:

Code:

---snipp
%prep
%setup
%build

[code]....

View 2 Replies View Related

Programming :: Create A ZIP In Perl Without Storing Path Information?

Mar 1, 2010

I have the following code snippet:

Code:

my $file = 'test/mybigfile';
my $zip = Archive::Zip->new();
my $zipped = $zip->addFile($file);

[code]....

it simply takes a file (in this case, "mybigfile") and creates a ZIP file containing that file only. Now, my problem is that when I go to decompress the ZIP file, it creates the relative (or absolute, depending on case) path of the original file. To make an example:

Code:

$ pwd
/tmp/perl
$ ls -R

[code]....

What I need is *not* to store the path information inside of the ZIP file, so that once I decompress the ZIP file I only get the original one without having paths created.

View 2 Replies View Related

CentOS 5 :: Create Repo And Wrong Path In Primary.xml.gz?

May 24, 2010

I want to set up an installation server for CentOS 5.5, using PXE for boot, kickstart for package selection (one for server), and NFS for share all files needed.I've succesfully completed a fresh installation of CentOS5 from the DVD for one of my servers (virgil), and I've copied the anaconda-ks.cfg generated by the installer to my install server (beatrix).

Next, I've properly configured the /etc/dhcpd.conf , the /tftpboot/pxelinux.cfg/<IP_CODED> and the /etc/exports for NFS sharing on beatrix.Then, I've copied all the first DVD of CentOS5 content in this folder on beatrix: /opt/CentOS_install I've tried to start virgil from ethernet, and all has gone ok, with the kickstart and so on! But I've decided to apply the updates (new kernel, sudo, xorg, ...), so I've deleted the old rpms from /opt/CentOS_install/CentOS and copied the new ones (downloaded from http://mirror.centos.org/centos-5/5/updates/x86_64/RPMS/). So, I've launched the following commands to recreate the repodata:

root@beatrix:/opt/CentOS_install/ # mv repodata/comps.xml CentOS/
root@beatrix:/opt/CentOS_install/ # rm -fr repodata
root@beatrix:/opt/CentOS_install/ # createrepo -p -o /opt/CentOS_install/ -g comps.xml /opt/CentOS_install/CentOS

But when I try to reinstall virgil, an error message appears, telling me that a package (perl-DBI-...) isn't present in the media.After some debugging, I've noticed that in the /opt/CentOS_install/repodata/primary.xml.gz there isn't the correct path for the rpms. If you look at the original primary.xml, the "path" is like:path="CentOS/abcxyz.rpm" while in the generated file (with createrepo) the path is:

path="abcxyz.rpm".How can I recreate the repodata with the correct path information?

View 6 Replies View Related

General :: How To Empty Several Subdirectories

Aug 18, 2010

I looked through google but can't find an answer for this..... say I have a directory called "files"; this directory contains several other directories..... what I wanna do is delete ALL the files within the subdirectories, but NOT delete the subdirectory. Can this be done easily without having to run a command for each subdirectory?

View 8 Replies View Related

General :: Include The Subdirectories In A Chown?

Jul 19, 2010

When I installed a new copy of my distro on another partition, in order to preserve all the settings from my old my user account, I made a user account with the same name on the new installation, and then copied my old user account's files (in their entirety) to the new user account, overwriting it. I did the copying from the root account (where else? I assume the new user account can't overwrite itself while it's open), and root became the owner of everything I copied, making it impossible to open the new user account. So I then chowned the new user account's folder to myself. I still can't get in, because apparently, chown only chowned the top folder, leaving all subdirectories owned by root. How do I make chown include all subdirectories? I scanned the man page, but didn't see a parameter.

View 4 Replies View Related

General :: Delete Matching Files In All Subdirectories?

Feb 22, 2010

How can I remove all .swp files in all of my subdirectories under Linux?

View 4 Replies View Related

General :: Running A Program In Multiple Subdirectories Simultaneously

Jul 8, 2011

Performing commands in multiple subdirectories simultaneously. I'd like to run a program I've copied into every subdirectory which takes *.in files in the current directory as input files. I can find the program, but how do I tell it to run when I've found it?

View 1 Replies View Related

General :: Executing A Script In Multiple Subdirectories Simultaneously?

Sep 14, 2010

i'd like to execute in several subdirectories that all have the same name, but I don't want to have to change into each subdirectory (there are hundreds) to execute the script. All the subdirectories have the same name ("final_alignments"), but are located in parent directories with different names. All these parent directories are in the same "super parent" directory. I've tried to do this using "for/do" and "find" but no luck so far.

View 8 Replies View Related

General :: Find All First Level Subdirectories Under The Current Directory?

Jan 24, 2011

1. How can you find all first level subdirectories under the current directory?
2. How will you show the last 100 lines of the file "foo.log"?
3. How will you Stream the contents of a the log file "foo.log" as it gets written to?
4. How can you grep for a pattern on a gzip'ed file? e.g., find "foo" in bar.gz
5. Find all lines in the file "foo" which DON'T have the pattern "bar"
6. Your web server is running very slowly. If you can login to the server, what command will you run to find out cpu and memory use?
7. Extract the file foo which is a part of the tar'ed, gzip'ed file bar.tar.gz
8. You attach a usb disk to your linux desktop, but it does not show up. How can you get more information about the error?
9. What is the secure way to login to remote systems?
10. What is the difference between TELNET and SSH?
11. Given a file 'a' with the following permissions -rwxrwxrwx 1 rohit rohit 0 2011-01-24 13:30 a Change its permissions such that it is only readable and writable by its owner, not accessible by anybody else in the group and only executable by the world
12. Difference between using ' and " for quoting a string / command in a shell
13. In the attached text file (test.txt) replace all occurrences of 'red' with 'yellow' without using an editor (i.e. from the command line)
14. How would you suppress output written to stderr by a command
15. Meaning of the #! notation in scripts e.g. #!/bin/sh
16. What is the output of the attached shell script test.sh Scripting questions, all based on the attached file access.log. Use one of perl, python, ruby, or shell scripts to solve these questsions. If any answer is obtained using just the command line, please include those commands as well.
17. How many accesses were made between 10am and 11.30am on Jan 24, 2011?
18. How many unique IP addresses accessed this server?
19. For every IP address which accessed this server, output a report showing number of hits for every type of HTTP status. For e.g., IP 192.168.1.20 has 164 hits with status 404 and 1690 hits with status 200.

View 8 Replies View Related

General :: Copy All .jpg Images In Subdirectories To A Specific Directory?

Aug 5, 2010

I have .jpg files in many subdirectories from where I need to copy all the images from all the sub directories and paste them to a specific directory.I have used `cp -rf *.jpg media/sik/` which only copies the .jpg files of the directory in which I was working.

View 5 Replies View Related

General :: Trying To Display Count Of Number Of Subdirectories In Directory

Feb 7, 2011

I am a noob and I am trying to display a count of the number of subdirectories in a directory. I have been able to use find -type d to list directories and subdirs but I want a numerical value of dirs and subdirs. I know ls -l gives a count but when I try ls -l -d all it shows is "." I also have tried a combination with the -R option but nothing seems to be working for me.Please forgive my ignorance but I am working on a script for class and this is the first step.

View 3 Replies View Related

General :: Recursively Remove Subdirectories And Files But Not The First Parent Directory?

Feb 11, 2010

I'm able to use the following to remove the target directory and recursively all of its subdirectories and contents. find '/target/directory/' -type d -name '*' -print0 | xargs -0 rm -rf

However, I do not want the target directory to be removed. How can I remove just the files in the target, the subdirectories, and their contents?

View 4 Replies View Related

General :: Giving User Write Access To Directory And Subdirectories

Aug 10, 2010

I need to give a user write access to /var/www and its subdirectories. The current directory permissions are as follows:rwx r-x r-x root root

I added the user to the root group but that didn't seem to help.I read I could chmod -R to change the access to write for the www directory and subdirectories but I don't want to change things and mess up the website. How can I give the user access to write to the www directory and subdirectories without messing anything up? Would changing the www directory group owner to his group cause an issue anywhere?

View 3 Replies View Related

General :: Get A Shell Script To Loop Through A Number Of Directories And Subdirectories?

Jul 27, 2010

I'm looking to get a shell script to loop through a number of directories and subdirectories,looking for files that contain a particular substring, and renaming the file by replacing the search string with a different substring. For example if you had a directory full of folders that contained digital photos (along with various other files which would need to remain unaffected), and the intent was to remove the "DSC_" prefix from several thousand files buried within. I've whipped up a rather long-winded solution that works well for this purpose but chokes on directory names with spaces. I am reasonably sure there's a 2 or 3-liner that would accomplish this exact same task.

function investigate
{
path=$1
for file in `ls $1`
#for file in *

[code]....

View 1 Replies View Related

General :: Command To Find A Specific Word In Directories And Subdirectories?

Jun 7, 2010

tell me the command used to find a specific word in directories and sub-directories in linux?

View 4 Replies View Related

General :: Script To Open All Subdirectories Of A Single Directory And Then Run A Command?

Mar 24, 2010

I am trying to write a very simple script that will go to every subdirectory of a single directory and run a command (lets call it make_ndx).I know I can write this the long way with in a text document with something like:

cd /"the directory"/"the 1st subdirectory"
make_ndx
cd ..
cd "the 2nd subdirectory"
cd ..

Alternatively, I also tried: for i in 'find /path/somemorepath -type d -mindepth 1'; do cd $i; make_ndx -f *.gro; done which returns me with the error cd: find: no such file or directory. But if I run the find command by itself to test if I am calling the right directories, it gives me the exactly the output I am looking for. Any ideas? Should I just write the find results to a file and loop through the contents of the file (which seems a little bit like overkill) or am I just making a simple typographical mistake and I am just not seeing it?

View 7 Replies View Related

General :: Allow Normal Users To Mount Tmpfs Under Subdirectories Of Their Home Directory?

Oct 11, 2010

How can I allow normal users to mount a tmpfs under any subdirectory owned by them?

View 3 Replies View Related

General :: Command Line - Automating A Task - Copy All Subdirectories And Files From One Directory To Another

Jun 10, 2010

I need to copy all subdirectories and files from one directory to another ever 5 minutes or so, with the old data automatically being overwritten with the new data. I'd also like this to run at startup. Is there any way this can be done? If so, what program would I need to schedule the automation and what is the command line I would need.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved