-
Xp_cmdshell & xp_fileexists
When I type exec master..xp_cmdshell 'dir *.* 'E:ABCEFG'
it shows the list of file and directorys(that's fine)
BUT if I type
master..xp_fileexist 'E:ABCEFGmydoc.txt'
it tells me:
File Exists File is a Directory Parent Directory Exists
----------- ------------------- -----------------------
0 0 0
When I know the file exists, and it shows up when using the first
command. Why, is it saying it dosen't exists?
the folder is a shared folder.
-
Xp_cmdshell & xp_fileexists (reply)
1)
If you run >EXEC master..xp_cmdshell 'dir *.* E:ABCEFG'<
it shows you the contents of the current working drive
and directory on your server (check directory name in output)
you should run >EXEC master..xp_cmdshell 'dir E:ABCEFG*.*'
2)
I suppose you didn't give the real directory names and that your
directory names contain spaces or special characters.
In this case you must surround the path name in the dir command with
double quotes ("
e.g.:
EXEC master..xp_cmdshell 'dir "C:Program FilesWindows NT*.*"'
if you then run
EXEC master..xp_fileexist '"C:Program FilesWindows NThypertrm.exe"'
it will not find the file, because the double qutes
are interreted as part of the name and results in
File Exists File is a Directory Parent Directory Exists
----------- ------------------- -----------------------
0 0 0
(1 row(s) affected)
instead you should run
EXEC master..xp_fileexist 'C:Program FilesWindows NThypertrm.exe'
which indicates that the file exists:
File Exists File is a Directory Parent Directory Exists
----------- ------------------- -----------------------
1 0 1
(1 row(s) affected)
------------
Kevin at 1/9/2002 3:00:08 PM
When I type exec master..xp_cmdshell 'dir *.* 'E:ABCEFG'
it shows the list of file and directorys(that's fine)
BUT if I type
master..xp_fileexist 'E:ABCEFGmydoc.txt'
it tells me:
File Exists File is a Directory Parent Directory Exists
----------- ------------------- -----------------------
0 0 0
When I know the file exists, and it shows up when using the first
command. Why, is it saying it dosen't exists?
the folder is a shared folder.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|