c sharp code to read excel and move files into sharepoint

 I want to migrate files from file  server to a document Library in SharePoint 2013.
 On a file server say 10 thousand files are there.
 I want to 1st create 8 thousand folders, then inside each folder 1 or max 3 files to be stored.
 I am using 1 Excel sheet for this with 2 columns ,where-
1.Folder Name, 2.Path of files (from which I  migrate files ).
So I will first create a folder for a set of few files then I want files into that folder.
 Any starting code pls
Who is Participating?
sharepointDepotAuthor Commented:
Will SzymkowskiSenior Solution ArchitectCommented:
If you are simply copying files to another location you might want to just use Robocopy...

PAQ - http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/Windows_Server_2008/Q_28258952.html

Use this example below...
robocopy source destination /E /ZB /DCOPY:T /COPYALL /R:1 /W:1 /V /TEE /LOG:Robocopy.log

Here's what the switches mean:

•source :: Source Directory (drive:\path or \\server\share\path).
•destination :: Destination Dir (drive:\path or \\server\share\path).
•/E :: copy subdirectories, including Empty ones.
•/ZB :: use restartable mode; if access denied use Backup mode.
•/DCOPY:T :: COPY Directory Timestamps.
•/COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU). Copies the Data, Attributes, Timestamps, Ownser, Permissions and Auditing info
•/R:n :: number of Retries on failed copies: default is 1 million but I set this to only retry once.
•/W:n :: Wait time between retries: default is 30 seconds but I set this to 1 second.
•/V :: produce Verbose output, showing skipped files.
•/TEE :: output to console window, as well as the log file.
•/LOG:file :: output status to LOG file (overwrite existing log).

Reference - http://community.spiceworks.com/topic/278298-move-shared-folders-and-retain-file-and-share-permissions-with-robocopy

sharepointDepotAuthor Commented:
my target location is sharepoint library.
How do you know if your security is working?

Protecting your business doesn’t have to mean sifting through endless alerts and notifications. With WatchGuard Total Security Suite, you can feel confident that your business is secure, meaning you can get back to the things that have been sitting on your to-do list.

Will SzymkowskiSenior Solution ArchitectCommented:
That should be fine. You can use the UNC path to the library and transfer the files needed.

sharepointDepotAuthor Commented:
my files are on folder in document library at url-


robocopy \\DEMO2010A\filezz \\intranet.contoso.com\Files /E /ZB /DCOPY:T /COPYALL /R:1 /W:1 /V /TEE /LOG:Robocopy.log

unable to copy files-
1.access denied
2.path incorrect
sharepointDepotAuthor Commented:
it helped to make folders
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.