@@ -348,6 +348,7 @@ public static void uploadDirectory() {
348348 .localSourceDirectory ("/tmp/test-directory" ) // Change this to your test directory
349349 .prefix ("uploads/" )
350350 .includeSubFolders (true )
351+ .followSymbolicLinks (false ) // Set to true to follow symbolic links during upload
351352 .build ();
352353
353354 System .out .println ("DirectoryUploadRequest created: " + request );
@@ -385,6 +386,49 @@ public static void uploadDirectory() {
385386 }
386387 }
387388
389+ /**
390+ * Uploads a directory to blob storage with symbolic links enabled. When followSymbolicLinks is
391+ * true, any symlinks in the directory will be followed and the target files/directories will be
392+ * uploaded.
393+ */
394+ public static void uploadDirectoryWithSymbolicLinks () {
395+ AsyncBucketClient asyncClient = getAsyncBucketClient (getProvider ());
396+
397+ DirectoryUploadRequest request =
398+ DirectoryUploadRequest .builder ()
399+ .localSourceDirectory ("/tmp/test-directory" )
400+ .prefix ("uploads-with-symlinks/" )
401+ .includeSubFolders (true )
402+ .followSymbolicLinks (true )
403+ .build ();
404+
405+ try {
406+ CompletableFuture <DirectoryUploadResponse > future = asyncClient .uploadDirectory (request );
407+ DirectoryUploadResponse response = future .get ();
408+
409+ getLogger ().info ("Directory upload with symbolic links completed" );
410+ getLogger ().info ("Failed transfers: {}" , response .getFailedTransfers ().size ());
411+
412+ if (!response .getFailedTransfers ().isEmpty ()) {
413+ response
414+ .getFailedTransfers ()
415+ .forEach (
416+ failure -> {
417+ getLogger ()
418+ .error (
419+ "Failed: {} - {}" ,
420+ failure .getSource (),
421+ failure .getException ().getMessage ());
422+ });
423+ } else {
424+ getLogger ().info ("All files (including symlinked) uploaded successfully!" );
425+ }
426+ } catch (Exception e ) {
427+ getLogger ()
428+ .error ("Directory upload with symbolic links failed: {}" , e .getMessage (), e );
429+ }
430+ }
431+
388432 /** Downloads a directory from blob storage */
389433 public static void downloadDirectory () {
390434 // Get the AsyncBucketClient instance
0 commit comments