General :: Get Last Subfolder On A Path?

Jul 29, 2011

I create a bash script and I assign a folder variable like:

#!/bin/bash
....
Myvariable_FOLDER_PATH=/PATH/TO/SPECIFIC/SUBFOLDER

is there any way to make another variable with just the specific SUBFOLDER

(?some command?)----> will make My_variable_subfolder = SUBFOLDER

so if I do

echo $Myvariable_FOLDER_PATH

i get: /PATH/TO/SPECIFIC/SUBFOLDER

and echo $My_variable_subfolder

i get: /SUBFOLDER

The tree and path names will change so I jjust want the last subfolder that I will access to access its files.

View 3 Replies


ADVERTISEMENT

General :: Upload File To The Subfolder?

Mar 21, 2011

why I cannot upload local files to subfolder in my home folder on FTP server? Say, i wanna upload files to /home/haolh/trial/occ/src/occ, but following error msg were given...

commandput "C:Proj rialoccsrcocc" "occ"
error/home/haolh/trial/occ/src/occ: open for write: permission denied

After google this prob, i've tried commands as below but it still failed

chmod 770 /home/haolh/
chown root:haolh /home/haolh/

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 :: Call Another Bash Script To Run On A Subfolder?

Sep 29, 2010

I want my bash script to run scripts located on a different folder. If it is also located on the same folder with my script, it will go like this:

on my $HOME folder: (this_script.sh, backup.sh, restore.sh, purge.sh)
#!/bin/bash
./backup.sh
./restore.sh
./purge.sh

But what if, on my $HOME folder: (this_script.sh)

$HOME/scripts folder: ( backup.sh,restore.sh, purge.sh )

Below doesn't work...

#!/bin/bash
./$HOME/scripts/backup.sh

View 5 Replies View Related

General :: User Write In A Subfolder When Can't Access Parent?

Jul 13, 2010

I was wondering, i have a webfolder and have permissions set to 770 with group being www-data. I would like to give access to one folder to a friend so he can edit images, css, etc. I made that folder 770 with group being site_name with www-data and him being in the group. So far so good it sounds like. However when i use the full path to the directory linux says it doesnt exist.

Is there a way i can make it so he doesnt have r/w file on files inside the parent directories and still access the directory i want to give him?

View 1 Replies View Related

General :: Delete A Subfolder ABC From Main Project Folder?

Jul 29, 2011

I want to delete a subfolder ABC in a main Project folder Globe. It occurs in many subfolders. It is very hectic to search and issue an rm -rf ABC command. I need to make a script for that .

View 4 Replies View Related

General :: Show Folder And Only One Subfolder Using Ls In Command Line?

Jul 13, 2011

I have many folders with many subfolders. All I want it to get the folder name and the first subfolder. I tried using ls -R but this give me more than I want it. Let say I have:

dir1/subdir1/sub_1_1/file.a
dir1/subdir1/sub_1_1/file.a2
dir1/subdir1/sub_1_1/file.a3

[code]....

All I want when I execute the command is to show me:

dir1/subdir1
dir1/subdir1
dir1/subdir2

[code]....

View 4 Replies View Related

General :: Zip -x For A Directory - Subfolder Contents Not Being Excluded Recursively?

Dec 9, 2010

I am attempting to use the zip command with the '-x' option to exclude a folder e.g. 'zip upload.zip public_html -x public_html/jquery/*'. However, parts of this folder are still being added to the archive. I made a shell script (saved as 'compress.sh' and ran as '. compress.sh') to do the archiving so I could test adding nested wildards for multiple subfolder levels.

Code:

#!/bin/bash
rm -f upload.zip
zip -r upload.zip public_html
-x public_html/jquery

[code]....

Each new line I added here that has the nested wildcards made the archive file size a bit smaller. Adding more /*'s than this didn't affect the file size. Even after all this though, there were still a couple megabytes of files and folders from the 'jquery' directory that were added to the archive.

Here's some examples of files and folders that were created after I unzipped the archive:
public_html/jquery/js/tablesorter/addons/pager/icons [folder]
public_html/jquery/js/tablesorter/addons/pager/.svn/entries [file]
public_html/jquery/js/tablesorter/build/.svn/text-base/js.jar.svn-base [file]

Why is it that despite all the -x lines, the files and folders like these were still being added to the archive? How can I simply recursively exclude the entire public_html/jquery folder from the archive?

View 4 Replies View Related

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

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

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

Ubuntu :: Move Folder Which Have Same Name In Subfolder?

Mar 1, 2010

How to move folder which have same name in subfolder Path : /root/Documents/untitled_folder/untitled_folder/abc.txt I want to move files from that folder how to do that

Output : /root/Documents/untitled_folder/abc.txt through terminal any idea ? and plz suggest a way to do in all folder present in directory recursevely how to check recursively in all folder's present in directory

./folder1/abc.txt
./folder1/folder1/abc.txt
./folder2/folder2/folder2/bbc.txt
./folder3/folder3/folder3/folder3/my.txt
./folder4/folder4/folder4/folder4/folder4/bcz.txt
./folder5/folder5/ca.txt

[Code]...

View 9 Replies View Related

Ubuntu :: How To Scan If There's A Subfolder In A Folder

Jun 27, 2010

I have a small bash script that compress all folders in a specific folderThe script also:- add a password to the compressed files- delete the original folder after compressionSuppose that this script is called "rar.sh".At some particular moment, there will not have any folder in the specific folder since they have all been compressed.I want something (a script?) that will check (every minute approximately) if there's new folder in the specific folder.If there's new folder, then execute script rar.shor if there's not new folder, then re-scan in the next minute.

View 2 Replies View Related

Server :: Directing A Domain To A Subfolder?

Nov 5, 2009

I have a virtual server which I am hoping to host several sites on. Each of these sites is in its own subfolder in /var/www/http/ Problem is when I set up DNS records they can only point to the http folder itself. I suppose I can just redirect each domain to then go to the required subfolder, but I'd like to keep the URL the user sees as a simple xxxxx.com (without subfolder).

View 3 Replies View Related

Server :: Samba - Browseable = No Not Working On Subfolder?

Apr 20, 2010

I am running samba-3.0.21b-2 browseable = no, not working on subfolder (worklocal) .. what I missed? work folder already invisible .. but when I entered into it .. I still able to see folder named local..

[work]
public = yes
only guest = no
writable = yes

[code]....

View 4 Replies View Related

General :: Command Path Is In PATH But Bash Does Not Find The Command

Jul 12, 2011

kernel 2.6.21.5, slackware 12.0
GNU bash 3.1.17

Code:

As you can see, /usr/local/bin is in the path. However, bash does not look for nasm in /usr/local/bin.

If I am root, things go well:

Code:

View 16 Replies View Related

Networking :: Creating Subfolder Permission Through Samba File (smb.conf)?

Dec 31, 2009

I have three users in samba file user1

user2
user3

and I have share1 and its subfolder " subshare " the thing i have to do is that, i have 2 assign user1 and user2 to share1 that means user1 and user2 can only access share1 through password and user3 can access only its subfolder "subshare" i have done this upto first level permission of share1 not able to do for its subfolder "subshare"

View 7 Replies View Related

Programming :: Java Applet Not Loading Image With Relative Path But With Absolute Path / Resolve It?

Jul 17, 2009

Java applet not loading image with relative path(e.g. images/1.jpg) but loads image with absolute path(i.e. from /root/user/images/1.jpg) . This is a problem when i want to host the applet on web server

View 2 Replies View Related

Red Hat / Fedora :: Appending A Path To PATH Variable Permanently?

Oct 21, 2010

how to add a path to PATH variable permanently so that it remains persisent even after closing shell and rebooting the system when i added a path, to variable it remained there as long as i didn't closed the shell. but when i reopened it ,changed were undone.

View 2 Replies View Related

SUSE / Novell :: Add Path To $PATH Variable?

Apr 19, 2009

I am trying to figure out how i can add the path /usr/sbin/ into the $PATH variable. I want this to be used from the normal account. I am bored settinh this manualy each time my computer starts.

View 2 Replies View Related

Debian :: Backup Purge Script - `/mnt/backup/subfolder': No Such File Or Directory

Nov 10, 2010

This script simply deletes files older than a certain age (in this case 7 days) from a certain location; I use it to purge old backups nightly, and it works as expected:

# delete backups older than 7 days
find /mnt/backup/*  -mtime +7 -exec rm -Rf {} ;

The problem is, every morning I get an email with an error message something like this:

find: `/mnt/backup/subfolder': No such file or directory

View 2 Replies View Related

Programming :: Awk/bash - "current Dir" - Script On A File In A Subfolder

Apr 25, 2011

I have a script (bash) that do some editing and stats on different logs (syslog) and output a file (html format). If i want to run the script on a file in a subfolder as the script where in that folder how do i do that?

Code:

makes a file called index.html with some stats from the syslog file.

if i run the script on a file in a subfolder

Code:

the script makes a output in the base folder, i want it to print the file to the test folder. There are multiple subolder and i want a index.html in each of them.

View 3 Replies View Related

Fedora :: Add Path In .bashrc By Commenting Out Old Path And Adding New One - Command Source ~/bashrc

Jun 14, 2011

When I add some path in .bashrc by commenting out old path and adding new one like this:

#EXPORT HOME_PLAY=/home/gem/old_play
EXPORT HOME_PLAY=/home/gem/play
EXPORT PATH=$PATH:HOME_PLAY

After saving above changes, I enter the command: source ~/.bashrc Now if I do echo $PATH, the path shows both the old PLAY_HOME and new PLAY_HOME. This is really bad and messes up a lot of things in my project. This problem only goes away if I logout or reboot, a rather very long process. What is happening is that the old path is added to new path element and the old path includes the old path element you want to remove.

View 10 Replies View Related

Programming :: Can I Get Absolute Path Without Giving A "path" But Inode Number By C

Aug 13, 2010

Does anyone know how to get the path with a inode number by C programming?
Or can I get the absolute path without giving a "path" but a inode number by C?

like this: get_path(unsigned inode);
not such this function: getcwd(".", xxx);
taowuwen@gmail.com

View 7 Replies View Related

General :: Samba File Permissions For Multiple Groups In The Same General Path?

Nov 4, 2009

I'm using my Linux (SLES 10) server as a File Server at this point. I need to set File Permissions to nested folders differently to different groups. For example:

homesharedengineering* should be read only for groupA
homesharedengineeringadmin should be read & write for groupB Plus read only for groupA
homesharedengineeringautocad should be read & write for groupC Plus read only for groupA

I've been using Webmin and Putty to set permissions but Putty only allows me the Default Group, it won't allow me to set several groups on the same directory. Webmin seems to allow me to add multiple groups (Webmin --> Others --> File Manager --> Info & ACL tab will provide extended abilities) but when I add multiple groups, they don't seem to take effect? I'm wondering if my setup at the 'Share' level or at the hierarchy of my folder structure (unix based) needs to be set specifically?

View 1 Replies View Related

Fedora :: 12 And VMTools - The Path "" Is Not Valid Path To The Gcc Binary

Mar 23, 2010

running Windows 7 64bit with VMware Workstation 7.01-build 227600. I have some knowledge of Linux, I have installed f12 and have updated the system as of 03/22/2010. All updates completed successfully.

1) How do I install VMTools on the f12 (after mounting the CD/DVD tool package)

2) How do I update the gcc files it says are dependencies?

Here's what I get on installation:Before you can compile modules, you need to have the following installed...

make
gcc
kernel headers of the running kernel

and then I am prompted for this input from the install script:

Searching for GCC...
The path "" is not valid path to the gcc binary.
Would you like to change it? [yes]

and this is where I get stuck. How do I get around this or satisfy the requirements for the install?

View 5 Replies View Related

General :: Why Is It Bad To Add '.' To PATH?

Aug 26, 2010

I've read one explanation saying it can allow malicious executables that are in the cwd to run in place of similarly named built-ins and core utilities.For something to wreak true havoc, wouldn't this only apply to root? And in any case, if '.' were appended to PATH instead of prepended, shouldn't that circumvent this "replacement" attack, since PATH's directories are scanned in order? (Aren't they scanned in order?)Are there any other issues besides this one?

View 4 Replies View Related

General :: Run An Ls Without Getting The Full Path?

Nov 11, 2010

I want a simple list of files in a directory that is not my current directory. I run ls /other/directory/*.txt and get:

/other/directory/file1.txt
/other/directory/file2.txt
I want:
file1.txt
file2.txt

How can I get the second list?

View 4 Replies View Related







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