Source path


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Source path
# 1  
Old 11-29-2012
Source path

what is the command for moving a file with it's original source path ?
# 2  
Old 11-29-2012
??

when you "move" a file to a new directory the new directory will be the new path to access the file...
There is no such thing except backups... or you printing the content of the source directory before removing the file and documenting in the new directory...
# 3  
Old 11-29-2012
ok that make much more sens for me. thank you Smilie
# 4  
Old 11-29-2012
Smilie I am trying to figure out what you are up to as a novice...
And try to help you achieve what can be...

If your idea is to "move" e.g. unused data file but that need to be put in the correct directory to be of some use... Lets say I have users squatting lots of space and I notice that the data has not changed for years but I need space on that filesystem, I would archive the content and gzip the archive, and save it in a hidden directory in the home directory of the user ( I can do that because I am root...) Now I let you struggle with the idea, it is a good idea to write a script to revert! commans you use for that? I use cpio (because Im familiar with it...) but you can use pax also.
# 5  
Old 11-29-2012
What I am trying to do is to move selected file from root into the created by me folder and then restore it back to its original location by shell script. Point is that I know how to automate the creation of a folder( if it exists - do nothing) and coping a file but I have no idea how to keep the source path of the file before its moved so I can restore it back with another script Smilie I simple don't know how to do it. I tried many web sites in order to find good answer and I couldn't find anything that I would understand.
# 6  
Old 11-29-2012
Well I gave you enough to read: look at the man pages of cpio, find, pax, tar ...
I am not going to do the work for you, you will learn nothing that way...
This User Gave Thanks to vbe For This Post:
# 7  
Old 11-29-2012
I understand very well i got enough hints to crack it on Smilie

---------- Post updated at 07:20 PM ---------- Previous update was at 06:15 PM ----------

This is what i came up with and it still doesnt work Smilie any sygestions ?
Code:
while{

	if $1  == "del" {

		mv $2 /tmp/.trash/

		echo `pwd`+$2 > /tmp/.trash/$2+"_info.txt"

	} else if $1 == "trash" {

		if $2 == "-a" {

			rm /tmp/.trash/*

		} else {

			rm /tmp/$2

		}

      

	} else if $1 == "restore" {

		mv /tmp/.trash/$2 `cat tmp/.trash/$2+"_info.txt"`

	}

}


Last edited by Oggie25; 11-29-2012 at 03:27 PM.. Reason: Code tags
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Convert Relative path to Absolute path, without changing directory to the file location.

Hello, I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)
Discussion started by: Sekhar419
4 Replies

2. UNIX for Advanced & Expert Users

Command to see the logical volume path, device mapper path and its corresponding dm device path

Currently I am using this laborious command lvdisplay | awk '/LV Path/ {p=$3} /LV Name/ {n=$3} /VG Name/ {v=$3} /Block device/ {d=$3; sub(".*:", "/dev/dm-", d); printf "%s\t%s\t%s\n", p, "/dev/mapper/"v"-"n, d}' Would like to know if there is any shorter method to get this mapping of... (2 Replies)
Discussion started by: royalibrahim
2 Replies

3. Web Development

Path to javascript source code at local browsing

Where should I put my javascript source code in order to run it "locally" by file not by http?---not sure this "locally" is the appropriate word here. My test is when my javascript code (test.js) is put in the site default folder as the test.html in /var/www/html both worked as expected with... (2 Replies)
Discussion started by: yifangt
2 Replies

4. Shell Programming and Scripting

Generate class path dynamically based on source path

Hi experts, I have multiple file names ending with .jsp located in $SOME_DIR, $SOME_DIR/f1/,$SOME_DIR/f2/test,$SOME_DIR/f3/fa and there are equivalent class files in $SOME_DIR/WEB-INF/classes/_pages,$SOME_DIR/WEB-INF/classes/_pages/_f1,... (0 Replies)
Discussion started by: oraclermanpt
0 Replies

5. Shell Programming and Scripting

I am trying to merge all csv files from source path into 1 file

I am trying to merge all csv files from source path into one single csv file in target. but getting error message: hadoop fs -cat /user/hive/warehouse/stage.db/PK_CLOUD_CHARGE/TCH-charge_*.csv > /user/hive/warehouse/stage.db/PK_CLOUD_CHARGE/final/TCH_pb_charge.csv getting error message:... (0 Replies)
Discussion started by: cplusplus1
0 Replies

6. Shell Programming and Scripting

Moving files from parent path to multiple child path using bash in efficient way

Hi All, Can you please provide some pointers to move files from Base path to multiple paths in efficient way.Folder Structure is already created. /Path/AdminUser/User1/1111/Reports/aaa.txt to /Path/User1/1111/Reports/aaa.txt /Path/AdminUser/User1/2222/Reports/bbb.txt to... (6 Replies)
Discussion started by: karthikgv417
6 Replies

7. UNIX for Advanced & Expert Users

SCP wihout a source path

Hi, I hope someone can explain if this is the right behaviour. I regularly use scp to copy files between hosts like this: scp -prv user@remotehost:/path/to/copy . However, today, I made a mistake and typed this instead: scp -prv user@remotehost: /path/to/copy . This started copying... (6 Replies)
Discussion started by: zlowryder
6 Replies

8. Linux

rpmbuild, how to specify a different source and destination path for files

I'd like to specify a different build and deployment path for files, by default the same path is used for both build and install, I wasn't able to find a way to make these different. With Solaris pkgadd, one can specify different paths in prototype, so I would assume something like that is possible... (0 Replies)
Discussion started by: tiburblium
0 Replies

9. Shell Programming and Scripting

Executing Commands From Non-Standard Path (Changing user's PATH secretely???)

Hi: I have a requirement as below: I have some standard Unix commands modified and kept them in a directory say /usr/clsh/bin. For example I have a script named "ls" kept here which is modified version of "ls" (say it always gives long listing i.e. ls -l). When any user logs on and types... (2 Replies)
Discussion started by: ramesh_samane
2 Replies
Login or Register to Ask a Question