File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,6 +97,14 @@ void backgroundWorker1_DoWork(object sender, DoWorkEventArgs eventArgs)
9797 {
9898 if ( dataGridView1 . Rows [ i ] . Cells [ 0 ] . Value . ToString ( ) . Contains ( data . SearchPattern ) )
9999 {
100+ if ( ! Directory . Exists ( data . TargetDirectory + Path . DirectorySeparatorChar ) )
101+ {
102+ // the target directory does not existing
103+ // maybe a broken name association or a network drive is not available
104+ // skip this and go on
105+ continue ;
106+ }
107+
100108 if ( File . Exists (
101109 data . TargetDirectory +
102110 Path . DirectorySeparatorChar +
@@ -113,14 +121,6 @@ void backgroundWorker1_DoWork(object sender, DoWorkEventArgs eventArgs)
113121 ) ;
114122 }
115123
116- if ( ! Directory . Exists ( data . TargetDirectory + Path . DirectorySeparatorChar ) )
117- {
118- // the target directory does not existing
119- // maybe a broken name association or a network drive is not available
120- // skip this and go on
121- continue ;
122- }
123-
124124 File . Move (
125125 dataGridView1 . Rows [ i ] . Cells [ 0 ] . Value . ToString ( ) ,
126126 data . TargetDirectory + Path . DirectorySeparatorChar + Path . GetFileName ( dataGridView1 . Rows [ i ] . Cells [ 0 ] . Value . ToString ( ) )
You can’t perform that action at this time.
0 commit comments