@@ -131,6 +131,12 @@ protected function configure() {
131131 's ' ,
132132 InputOption::VALUE_NONE ,
133133 'always confirm to continue in case of skipped shares. '
134+ )
135+ ->addOption (
136+ 'destination-use-user-folder ' ,
137+ 'u ' ,
138+ InputOption::VALUE_NONE ,
139+ 'if destination user never logged in and thus has no mounts transfer directly to top-level user folder. '
134140 );
135141 }
136142
@@ -164,10 +170,6 @@ protected function execute(InputInterface $input, OutputInterface $output) {
164170 return 2 ;
165171 }
166172
167- // use a date format compatible across client OS
168- $ date = \date ('Ymd_his ' );
169- $ this ->finalTarget = "$ this ->destinationUser /files/transferred from $ this ->sourceUser on $ date " ;
170-
171173 // setup filesystem
172174 Filesystem::initMountPoints ($ this ->sourceUser );
173175 Filesystem::initMountPoints ($ this ->destinationUser );
@@ -207,6 +209,17 @@ protected function execute(InputInterface $input, OutputInterface $output) {
207209 return 1 ;
208210 }
209211 }
212+ // prepare and validate final destination
213+ if ($ input ->getOption ('destination-use-user-folder ' ) && $ destinationUserObject ->getLastLogin () === 0 ) {
214+ $ this ->finalTarget = "$ this ->destinationUser /files " ;
215+ } elseif ($ input ->getOption ('destination-use-user-folder ' ) && $ destinationUserObject ->getLastLogin () !== 0 ) {
216+ $ output ->writeln ("<error>Cannot use top-level user folder as destination folder if user aleardy logged in</comment> " );
217+ return 1 ;
218+ } else {
219+ // use a date format compatible across client OS
220+ $ date = \date ('Ymd_his ' );
221+ $ this ->finalTarget = "$ this ->destinationUser /files/transferred from $ this ->sourceUser on $ date " ;
222+ }
210223
211224 // transfer the files
212225 $ this ->transfer ($ output );
0 commit comments