Sponsored Content
Operating Systems Linux Create a dummy file even if the path is not exist Post 302644703 by snreddy_gopu on Tuesday 22nd of May 2012 09:45:01 AM
Old 05-22-2012
Create a dummy file even if the path is not exist

hi,

i want to create a dummy file even if the path to that file is not exist as follows.
suppose, in my working directory 2 files are there. and
i create one more file which is exist as follows

Code:
# pwd
/home/satya
# ls
file1.txt  file2.txt
# echo dummy > /home/satya/file3.txt
# ls
file1.txt  file2.txt  file3.txt


now i want to create a file which path is not exist.

Code:
# echo dummy > /home/satya/temp_dir/file4.txt
-bash: /home/satya/temp_dir/file4.txt: No such file or directory

we can create directory and then create dummy file.
but there is a problem when there are more directories to be created.

i need these things with in a script.
input to the script is names of the files with full path in which some directories are not exist like
/dir1/dir2/dir3/dir4/file1.txt
/dir1/dir2/dir5/dir6/file2.txt

Last edited by snreddy_gopu; 05-22-2012 at 10:51 AM..
 

10 More Discussions You Might Find Interesting

1. SCO

Create dummy printer

On SCO Openserver we create a so called dummy printer that directs to /dev/null (we use this in our software to purge some stuff). Now I have SCO UnixWare 7.1.4, but I cannot create a dummy printer. I create the printer exactly as in Openserver by the Printer Manager, - Enter spoolname -... (1 Reply)
Discussion started by: p.vvugt
1 Replies

2. Shell Programming and Scripting

If file not exist create a new one

i want a script to check whether the file name exits or not if not it has to create a new one (3 Replies)
Discussion started by: din_annauniv
3 Replies

3. Linux

How to create zip file without path?

Hello, I have generated a PHP script that creates files needed for EPUB file. I have a temp directory where these files are created into and then needs to be zipped. The directory structure is: mimetype content.opf index.html stylesheet.css toc.ncx META-INF META-INF/container.xml ... (4 Replies)
Discussion started by: spaze
4 Replies

4. AIX

AIX cp error: "A file or directory in the path does not exist"

Hello fellow UNIX fans, I'm running AIX 4.3 and getting an error message “cp: /a/file2.db: A file or directory in the path does not exist” when I run the following command: cp /b/file.db /a/file2.db It stops every time about 95% of the way through the copy process at 1,073,741,312 bits. ... (3 Replies)
Discussion started by: Jackson123
3 Replies

5. Shell Programming and Scripting

A shell script for create a a file in the respective path

Hello forum members, I have to create a out file in the current path./aaa/bbb/ccc/hhh. i am writing script below. ###script Begins##### #!/bin/ksh echo "Weclome" if then echo "Hello" rm -rf $aaa/bbb/ccc/hhh #clean the exsisting o/p file echo "no... (2 Replies)
Discussion started by: rajkumar_g
2 Replies

6. Shell Programming and Scripting

Create a dummy file in all directories that include a .jpg

Hello. My latest project has me with the need for the following script. Basically, any directory that includes a .jpg file needs to also have a ".picture" file created (if it doesn't exist). Here's an example of what I need. /mnt/user/Pictures/2011/Hawaii - 2011/.picture... (11 Replies)
Discussion started by: Davinator
11 Replies

7. Shell Programming and Scripting

find + move if destination path does not exist

hi frnds, please help ... what will happen with below command if destination path does not exist on the system.... find /var/adm/cft* -mtime +1 -exec mv {} /global/ \ in unix its remove all my files from the system from soruce file ... how is it possbile (1 Reply)
Discussion started by: dodasajan
1 Replies

8. Shell Programming and Scripting

Set variable to path that does not exist on local host

Can anyone suggest a workaround zone_5.org='/qaz/qwe/path/tns.osn' output /home/bingo/XXX_script.sh: line 180: zone_5.org=/qaz/qwe/path/tns.osn: no parent The path does not exist on the local machine, the allocation used to work till the server was upgraded. Red Hat Enterprise Linux... (2 Replies)
Discussion started by: squrcles
2 Replies

9. Shell Programming and Scripting

Find if a directory exist from a list of the path

Hello, i want to script on sh to check from a path if the directory exist and isn't empty. I explain: path is : /aaa/bbb/ccc/ccc_name/ddd/ Where the cccc_name is in a list, so i think it's $1 My command find -name /aaa/bbb/ccc/$1/ddd/ didn't work because my $1 is the same and not... (5 Replies)
Discussion started by: steiner
5 Replies

10. UNIX for Beginners Questions & Answers

A file or directory in the path does not exist

I'm brand new to AIX and I looked up how to print this file and it was working but now I'm not able to do it all of a sudden. the file name is rom1.txt so this is what i wrote in the command line and I know I'm in the right directory. In bold is what I seem to be messing up with. prod @ root... (3 Replies)
Discussion started by: Dark0Prince
3 Replies
REMINISCENCE(6) 						   REminiscence 						   REMINISCENCE(6)

NAME
reminiscence - a wrapper around rs with changed defaults SYNOPSIS
reminiscence reminiscence --datapath path reminiscence --savepath path reminiscence --levelnum num reminiscence --help DESCRITION
reminiscence is a tiny wrapper for /usr/games/rs, the REminiscence engine. It supports the same options as rs(6). The wrapper bails out if the data directory does not exist. It will also create the save game directory if needed. OPTIONS
--datapath path Use path for locating game data. Defaults to .reminiscence/data in user's home directory. reminiscence exits with an error if the directory does not exist. --savepath path Use path for game saves. Defaults to .reminiscence/save in user's home directory. The directory is created if needed. --levelnum num Start from level num. Default is 0. --help Display short usage info. SEE ALSO
rs(6) COPYRIGHT AND LICENSE
Copyright 2010, 2011 Damyan Ivanov dmn@debian.org Permission is granted to use this work, with or without modifications, provided that this notice is retained. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return. REminiscence 0.1.9 2011-03-17 REMINISCENCE(6)
All times are GMT -4. The time now is 01:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy