Visualizzazione dei risultati da 1 a 2 su 2

Discussione: rsync spazi bianchi

  1. #1
    Utente di HTML.it
    Registrato dal
    Sep 2010
    Messaggi
    2

    rsync spazi bianchi

    Ciao a tutti, sto cercando di listare il contenuto di alcune directory utilizzando il comando "rsync": la cosa funziona soltanto nel caso in cui non vi siano spazi nel path che inserisco. Ho provato con:

    codice:
    Process p = Runtime.getRuntime().exec("rsync /path_to_dir/dir with spaces/");  
     Process p = Runtime.getRuntime().exec("rsync /path_to_dir/dir\ with\ spaces/");   
    Process p = Runtime.getRuntime().exec("rsync \"/path_to_dir/dir with spaces/\"");   
    Process p = Runtime.getRuntime().exec("rsync /path_to_dir/\"dir with spaces\"/");   
    Process p = Runtime.getRuntime().exec(new String[]{"rsync", "/path_to_dir/\"dir with spaces\"/"});
    ma nessuno di questi funziona.

    Qualche suggerimento (utilizzando sempre il comando rsync, non la classe "File" per poi fare getChildren())?

    Grazie

  2. #2
    Utente di HTML.it
    Registrato dal
    Sep 2010
    Messaggi
    2
    Risolto facendo semplicemente

    codice:
    Process p = Runtime.getRuntime().exec(new String[]{"rsync", "/path_to_dir/dir with spaces"})
    senza alcun escape character

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.