Re: Read Only Property in Windows XP Getting in the Way of FileCopy
- From: Salad <oil@xxxxxxxxxxx>
- Date: Fri, 21 Mar 2008 05:44:11 -0700
Tim Dunne wrote:
Hello All,
I posted a similar message in one of the Windows XP forums, but since
this is actually a problem generated by Access, I figured I would try
here too.
I am adding functionality to an Access 2007 database that creates a
folder containing another folder named Digital Images. The user has
created a folder to store original digital images. The application
first allows the user to browse to a location for the "Destination"
folder, and browse to the folder containing the "Original" digital
images. A default destination folder name is generated and the option
to change the name is given, These values are all stored in unbound
text boxes on a form. The user then presses a button and on the click
event a series of data validation tests are performed.
I created a preliminary test sub called CopyDigitalImages. I call it
from the click event, after error checking. The subroutine receives
two parameters: strOriginalPath and strDestinationPath which are taken
from their respective text boxes. Each digital image file name is
stored in the database as strDigitalReference and is assigned a
formatted file name called strDigitalID. The idea is to take the
image from the Original folder referencing it by strDigitalReference,
copy it, move it to the "Destination" folder, and rename it in the
destination folder according to its strDigitalID. I use a recordset
to perform the renaming operation, and according to the information I
receive using debug.print, it is working fine.
All of this sets the stage for my snag. When I perform the operation
FileCopy strOriginalFile, strDestination File I get a Run-time error
'75': Path/File access error. I researched the problem and noticed
that all of my folders were set to read only, but not with a check,
with a sort of highlighted third state. This indicated to me that
maybe a subfolder might be set to read only, but this happened in top
level directories with no subfolders. Clicking and resetting the Read
Only Property of the invidual folders did not work since even though
the check box was cleared, the property reset itself when I went back
in. I am running Win XP Home SP2.
I tried resetting the read only property in c:\Documents and Settings
using the Dos command attrib -r /s *.*, as suggested here:
http://support.microsoft.com/kb/326549
I tried configuring Windows to use the system flag as suggested here:
http://windowsitpro.com/article/articleid/24940/why-cant-i-remove-the-read-only-flag-from-a-windows-xp-or-windows-2000-folder.html
I have tried disabling simple file sharing from the Control Panel
(even though this fix is supposed to be for Pro).
I tried resetting the owner of my C: drive in Safe Mode as suggested
here (even though when I check security and I am listed as an
Administrator):
http://www.askdavetaylor.com/why_is_everything_in_my_documents_marked_read_only.html
I have set full rights for everyone on individual files, top level
directories, and bottom level folders.
I am at my wit's end. This is the first application I am developing in
Access 2007 (mainly for the Attachment data type since this is a
pretty image intense program). Previously I have used
Application.FileSearch to do this sort of thing and that no longer
works in 2007. If there is anyone at all out there who has run into
this problem and found a solution, or if there is some other way of
going about this, I am all ears. I can provide some sample code if
needed, but I think my post is already long enough and I hope it draws
an accurate picture of the problem. At the very least, thank you for
reading my issue.
Regards,
Tim Dunne
Are you using MkDir to make the destination folder? Are you using FileCopy to copy the source and destination? You can rename a folder with Name. And kill a file with Kill.
Have you done a
msgbox strOriginal & vbNewLIne & strDestination
to see what the values are of the folder/file names? Perhaps you don't have a \ to separate the folder from the filename.
You have to create the destination folder first before you can do a copy. If you did a mkdir on c:\f1\f2\fn.jpg and f1 didn't exist, that won't work..you have to create f1 before f2.
Here's what help said regarding your error.
1) The file specification isn't correctly formatted.
2) A file name can contain a fully qualified (absolute) or relative path. A fully qualified path starts with the drive name (if the path is on another drive) and lists the explicit path from the root to the file. Any path that isn't fully qualified is relative to the current drive and directory.
3) You attempted to save a file that would replace an existing read-only file. Change the read-only attribute of the target file or save the file with a different file name.
4) You attempted to open a read-only file in sequential Output or Append mode. Open the file in Input mode or change the read-only attribute of the file.
I doubt 3 and 4 are your problem. I'd look at 1 and 2.
Carolina
http://www.youtube.com/watch?v=zZsNtV7gwk8
.
- Follow-Ups:
- References:
- Read Only Property in Windows XP Getting in the Way of FileCopy
- From: Tim Dunne
- Read Only Property in Windows XP Getting in the Way of FileCopy
- Prev by Date: Re: Passing paramters between combo boxes access 2007
- Next by Date: Re: Calculating\Displaying Time over 24 hrs
- Previous by thread: Read Only Property in Windows XP Getting in the Way of FileCopy
- Next by thread: Re: Read Only Property in Windows XP Getting in the Way of FileCopy
- Index(es):
Relevant Pages
|