0

hello everybody..

I have a table which contains all the info about a file i.e its id, name, size, createddt and modifieddt.
now i need to copy all the files(file content) to a local drive.
Gotta do this in c# console application. Can anybody help me?

2
Contributors
3
Replies
13
Views
3 Years
Discussion Span
Last Post by Ketsuekiame
0

Select the data from the database, create a file with the correct name and write the data to it. You will need to decide what kind of writer based on the data type ie. Binary or Plain Text

You can use methods on the File class to do things like SetCreationTime and SetLastWriteTime.

0

hey Ketsuekiame, thanks for the reply .. let me be more specific.. for instance when a file.docx is uploaded.. the file is saved under D:/Folder and the details of the file are inserted in the sql db.. now in E:/folder i need to copy all the files from D:/folder based on the folder name and time of upload.. once a file is copied to E:/folder it shouldn't copied again.can yu get my point?

0

If the file contents themselves are not stored in the database and you don't have a service that has access to the local file system then you will not be able to retrieve the file data.

Otherwise you just need to read the database to find the file location and return the byte array you get from reading the file back to the caller of the service. Then once you have done that you would remove the file from the local disk and the database.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.