Bash - Salida de tubería de LS a RSYNC -- bash campo con terminal campo con pipe campo con rsync camp Relacionados El problema

bash - Pipe output from ls to rsync


5
vote

problema

Español

Estoy tratando de usar rsync Para copias de seguridad de las carpetas que contienen una determinada palabra, usando ls , grep y rsync66668877666 . Sin embargo, rsync no parece aceptar la salida de grep como entrada. He intentado lo siguiente:

  $ ls -d $PWD/** | grep March | rsync -av 'dst'   

Esto no hace nada realmente, aunque el uso de solo public class MyNewAndroidActivity extends Activity { protected Socket socket; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button button_connect = (Button) findViewById(R.id.button1); final Button button_disconnect = (Button) findViewById(R.id.button2); final Button b_forward = (Button) findViewById(R.id.b_forward); final Button b_backward = (Button) findViewById(R.id.b_backward); final Button b_right = (Button) findViewById(R.id.b_right); final Button b_left = (Button) findViewById(R.id.b_left); final Button b_stop = (Button) findViewById(R.id.b_stop); button_connect.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { // Create socket with time out //192.168.1.76 // my code which I want to transfer it. int port = 2005; SocketAddress sockaddr = new InetSocketAddress("192.168.1.15", port); socket = new Socket(); int timeoutMs = 2000; socket.connect(sockaddr, timeoutMs); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); 010 produce exactamente la lista de carpetas que quiero mover.

  public class MyNewAndroidActivity extends Activity {     protected Socket socket;       /** Called when the activity is first created. */     @Override     public void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.main);         final Button button_connect = (Button) findViewById(R.id.button1);         final Button button_disconnect = (Button) findViewById(R.id.button2);         final Button b_forward = (Button) findViewById(R.id.b_forward);         final Button b_backward = (Button) findViewById(R.id.b_backward);         final Button b_right = (Button) findViewById(R.id.b_right);         final Button b_left = (Button) findViewById(R.id.b_left);         final Button b_stop = (Button) findViewById(R.id.b_stop);           button_connect.setOnClickListener(new View.OnClickListener() {               public void onClick(View v) {                 try {             // Create socket with time out             //192.168.1.76         // my code which I want to transfer it.                  int port = 2005;      SocketAddress sockaddr = new  InetSocketAddress("192.168.1.15", port);                        socket = new Socket();                        int timeoutMs = 2000;                        socket.connect(sockaddr, timeoutMs);                        }                  catch (UnknownHostException e) {                     // TODO Auto-generated catch block                         e.printStackTrace();                     }                                catch (SocketException e) {                     // TODO Auto-generated catch block                     e.printStackTrace();                 } catch (IOException e) {                     // TODO Auto-generated catch block                     e.printStackTrace();                 } catch (SecurityException e) {                     // TODO Auto-generated catch block                     e.printStackTrace();                 }               }         }); 111  

Muchos (incluyendo public class MyNewAndroidActivity extends Activity { protected Socket socket; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button button_connect = (Button) findViewById(R.id.button1); final Button button_disconnect = (Button) findViewById(R.id.button2); final Button b_forward = (Button) findViewById(R.id.b_forward); final Button b_backward = (Button) findViewById(R.id.b_backward); final Button b_right = (Button) findViewById(R.id.b_right); final Button b_left = (Button) findViewById(R.id.b_left); final Button b_stop = (Button) findViewById(R.id.b_stop); button_connect.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { // Create socket with time out //192.168.1.76 // my code which I want to transfer it. int port = 2005; SocketAddress sockaddr = new InetSocketAddress("192.168.1.15", port); socket = new Socket(); int timeoutMs = 2000; socket.connect(sockaddr, timeoutMs); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); 2 , AQUÍ ESCAPE EL ESPACIO CON public class MyNewAndroidActivity extends Activity { protected Socket socket; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button button_connect = (Button) findViewById(R.id.button1); final Button button_disconnect = (Button) findViewById(R.id.button2); final Button b_forward = (Button) findViewById(R.id.b_forward); final Button b_backward = (Button) findViewById(R.id.b_backward); final Button b_right = (Button) findViewById(R.id.b_right); final Button b_left = (Button) findViewById(R.id.b_left); final Button b_stop = (Button) findViewById(R.id.b_stop); button_connect.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { // Create socket with time out //192.168.1.76 // my code which I want to transfer it. int port = 2005; SocketAddress sockaddr = new InetSocketAddress("192.168.1.15", port); socket = new Socket(); int timeoutMs = 2000; socket.connect(sockaddr, timeoutMs); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); 3 ) de las carpetas Pensé que podría causar problemas y encontrar public class MyNewAndroidActivity extends Activity { protected Socket socket; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button button_connect = (Button) findViewById(R.id.button1); final Button button_disconnect = (Button) findViewById(R.id.button2); final Button b_forward = (Button) findViewById(R.id.b_forward); final Button b_backward = (Button) findViewById(R.id.b_backward); final Button b_right = (Button) findViewById(R.id.b_right); final Button b_left = (Button) findViewById(R.id.b_left); final Button b_stop = (Button) findViewById(R.id.b_stop); button_connect.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { // Create socket with time out //192.168.1.76 // my code which I want to transfer it. int port = 2005; SocketAddress sockaddr = new InetSocketAddress("192.168.1.15", port); socket = new Socket(); int timeoutMs = 2000; socket.connect(sockaddr, timeoutMs); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); 4 Podría ser de ayuda, pero aún no se mueve nada.

He intentado lo anterior con public class MyNewAndroidActivity extends Activity { protected Socket socket; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button button_connect = (Button) findViewById(R.id.button1); final Button button_disconnect = (Button) findViewById(R.id.button2); final Button b_forward = (Button) findViewById(R.id.b_forward); final Button b_backward = (Button) findViewById(R.id.b_backward); final Button b_right = (Button) findViewById(R.id.b_right); final Button b_left = (Button) findViewById(R.id.b_left); final Button b_stop = (Button) findViewById(R.id.b_stop); button_connect.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { // Create socket with time out //192.168.1.76 // my code which I want to transfer it. int port = 2005; SocketAddress sockaddr = new InetSocketAddress("192.168.1.15", port); socket = new Socket(); int timeoutMs = 2000; socket.connect(sockaddr, timeoutMs); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); 5 , el public class MyNewAndroidActivity extends Activity { protected Socket socket; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button button_connect = (Button) findViewById(R.id.button1); final Button button_disconnect = (Button) findViewById(R.id.button2); final Button b_forward = (Button) findViewById(R.id.b_forward); final Button b_backward = (Button) findViewById(R.id.b_backward); final Button b_right = (Button) findViewById(R.id.b_right); final Button b_left = (Button) findViewById(R.id.b_left); final Button b_stop = (Button) findViewById(R.id.b_stop); button_connect.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { // Create socket with time out //192.168.1.76 // my code which I want to transfer it. int port = 2005; SocketAddress sockaddr = new InetSocketAddress("192.168.1.15", port); socket = new Socket(); int timeoutMs = 2000; socket.connect(sockaddr, timeoutMs); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); 616 para public class MyNewAndroidActivity extends Activity { protected Socket socket; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button button_connect = (Button) findViewById(R.id.button1); final Button button_disconnect = (Button) findViewById(R.id.button2); final Button b_forward = (Button) findViewById(R.id.b_forward); final Button b_backward = (Button) findViewById(R.id.b_backward); final Button b_right = (Button) findViewById(R.id.b_right); final Button b_left = (Button) findViewById(R.id.b_left); final Button b_stop = (Button) findViewById(R.id.b_stop); button_connect.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { // Create socket with time out //192.168.1.76 // my code which I want to transfer it. int port = 2005; SocketAddress sockaddr = new InetSocketAddress("192.168.1.15", port); socket = new Socket(); int timeoutMs = 2000; socket.connect(sockaddr, timeoutMs); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); 7 y public class MyNewAndroidActivity extends Activity { protected Socket socket; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button button_connect = (Button) findViewById(R.id.button1); final Button button_disconnect = (Button) findViewById(R.id.button2); final Button b_forward = (Button) findViewById(R.id.b_forward); final Button b_backward = (Button) findViewById(R.id.b_backward); final Button b_right = (Button) findViewById(R.id.b_right); final Button b_left = (Button) findViewById(R.id.b_left); final Button b_stop = (Button) findViewById(R.id.b_stop); button_connect.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { // Create socket with time out //192.168.1.76 // my code which I want to transfer it. int port = 2005; SocketAddress sockaddr = new InetSocketAddress("192.168.1.15", port); socket = new Socket(); int timeoutMs = 2000; socket.connect(sockaddr, timeoutMs); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); 8 Aunque esto Incluido en la opción public class MyNewAndroidActivity extends Activity { protected Socket socket; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button button_connect = (Button) findViewById(R.id.button1); final Button button_disconnect = (Button) findViewById(R.id.button2); final Button b_forward = (Button) findViewById(R.id.b_forward); final Button b_backward = (Button) findViewById(R.id.b_backward); final Button b_right = (Button) findViewById(R.id.b_right); final Button b_left = (Button) findViewById(R.id.b_left); final Button b_stop = (Button) findViewById(R.id.b_stop); button_connect.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { // Create socket with time out //192.168.1.76 // my code which I want to transfer it. int port = 2005; SocketAddress sockaddr = new InetSocketAddress("192.168.1.15", port); socket = new Socket(); int timeoutMs = 2000; socket.connect(sockaddr, timeoutMs); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); 9 . Por lo general, uso la opción rsync20 para public class IBMEyes extends Activity implements SensorListener{ protected static Socket socket; final String tag = "MyProject"; String state ="off"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); sm = (SensorManager) getSystemService(SENSOR_SERVICE); setContentView(R.layout.main); Button b_connect = (Button) findViewById(R.id.button1); b_connect.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub SocketConnect(); } }); // here is my code that I've transferred it. public void SocketConnect() { // TODO Auto-generated method stub try { int port = 2005; SocketAddress sockaddr = new InetSocketAddress("192.168.1.15", port); socket = new Socket(); int timeoutMs = 2000; socket.connect(sockaddr, timeoutMs); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } } 1 pero también he intentado sin. ¿Qué estoy haciendo mal? ¿Es posible la entrada de la tubería a public class IBMEyes extends Activity implements SensorListener{ protected static Socket socket; final String tag = "MyProject"; String state ="off"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); sm = (SensorManager) getSystemService(SENSOR_SERVICE); setContentView(R.layout.main); Button b_connect = (Button) findViewById(R.id.button1); b_connect.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub SocketConnect(); } }); // here is my code that I've transferred it. public void SocketConnect() { // TODO Auto-generated method stub try { int port = 2005; SocketAddress sockaddr = new InetSocketAddress("192.168.1.15", port); socket = new Socket(); int timeoutMs = 2000; socket.connect(sockaddr, timeoutMs); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } } 2 como este?

Estoy en OSX 10.13.3. GNU Bash, versión 3.2.57 (1)

gracias.

Original en ingles

I'm trying to use rsync to backup folders containing a certain word, using ls, grep and rsync. However rsync does not seem to accept output from grep as input. I've tried the following:

$ ls -d $PWD/** | grep March | rsync -av 'dst' 

This does nothing really, even though using just ls -d $PWD/** | grep March produces exactly the list of folders I want to move.

$ ls -d $PWD/** | grep March | xargs -0 | rsync -av 'dst' $ ls -d $PWD/** | grep March | xargs -0 echo | rsync -av 'dst' $ ls -d $PWD/** | grep March | xargs -0 rsync -av 'dst' 

Many(including dst, here I escape space with \) of the folders contains spaces I thought that might cause problems and found xargs might be of help, but still doesn't move anything.

I have tried the above with sudo, the -avuoption for rsync and -r even though this i included in the -aoption. I usually use the --dry-run option for rsync but I've also tried without. What am I doing wrong? Is it possible to pipe input to rsync like this?

I'm on OSX 10.13.3. GNU bash, version 3.2.57(1)

Thank you.

           
   
   

Lista de respuestas

5
 
vote
vote
La mejor respuesta
 

Uso del ls- --include-from3 grep , lo que desea es probable:

  ls -d "$PWD"/** | grep March | xargs -r -n1 -I'{}' rsync -av '{}' 'dst'   

Un mejor método es usar --include-from6

Una opción es dejar que Bash emule un tubo con nombre:

  rsync -av0 --include-from=<(find . -path '*March*' -print0) "$PWD"/ /dst/   

También puede incluir la salida Buscar en lugar:

  find . -path '*March*' -print0| rsync -av0 --include-from=- "$PWD"/ /dst/   

-path se utiliza para encontrar "March" en cualquier lugar del nombre de archivo. (Similar a public class AdminController : Controller { public ActionResult LoadFoos() { if (Request.Files.Count > 0) { // This illustrates how to read the uploaded file contents, // and would need to be adapted to your scenario List<string> foos = new List<string>(); using (StreamReader reader = new StreamReader(Request.Files[0].InputStream)) { while (!reader.EndOfStream) { string line = reader.ReadLine(); foos.Add(line); } } // TODO: use LINQ 2 SQL, NHibernate or ADO.NET to load the foos directly, // or call a web/WCF service behind your firewall that does this } return View(); } } 0 )

(RSYNC podría tener algunos parámetros para hacer el filtrado en sí mismo, como el public class AdminController : Controller { public ActionResult LoadFoos() { if (Request.Files.Count > 0) { // This illustrates how to read the uploaded file contents, // and would need to be adapted to your scenario List<string> foos = new List<string>(); using (StreamReader reader = new StreamReader(Request.Files[0].InputStream)) { while (!reader.EndOfStream) { string line = reader.ReadLine(); foos.Add(line); } } // TODO: use LINQ 2 SQL, NHibernate or ADO.NET to load the foos directly, // or call a web/WCF service behind your firewall that does this } return View(); } } 1 y public class AdminController : Controller { public ActionResult LoadFoos() { if (Request.Files.Count > 0) { // This illustrates how to read the uploaded file contents, // and would need to be adapted to your scenario List<string> foos = new List<string>(); using (StreamReader reader = new StreamReader(Request.Files[0].InputStream)) { while (!reader.EndOfStream) { string line = reader.ReadLine(); foos.Add(line); } } // TODO: use LINQ 2 SQL, NHibernate or ADO.NET to load the foos directly, // or call a web/WCF service behind your firewall that does this } return View(); } } 2 PATTELS)

algo como esto (no probado). Consulte aquí

  public class AdminController : Controller {     public ActionResult LoadFoos()     {         if (Request.Files.Count > 0)         {             // This illustrates how to read the uploaded file contents,             // and would need to be adapted to your scenario             List<string> foos = new List<string>();              using (StreamReader reader = new StreamReader(Request.Files[0].InputStream))             {                 while (!reader.EndOfStream)                 {                     string line = reader.ReadLine();                      foos.Add(line);                 }             }              // TODO: use LINQ 2 SQL, NHibernate or ADO.NET to load the foos directly,             // or call a web/WCF service behind your firewall that does this         }          return View();     } } 3  
 

Using the problematic ls and grep, what you want is likely:

ls -d "$PWD"/** | grep March | xargs -r -n1 -I'{}' rsync -av '{}' 'dst' 

A better method is to use --include-from

One option is to let bash emulate a named pipe:

rsync -av0 --include-from=<(find . -path '*March*' -print0) "$PWD"/ /dst/ 

You can also pipe the find output instead:

find . -path '*March*' -print0| rsync -av0 --include-from=- "$PWD"/ /dst/ 

-path is used to find "March" anywhere in the filename. (similar to grep)

(rsync might have some parameters to do the filtering itself as well, like the --include and --exclude patterns)

Something like this (untested). See here

rsync -av --include="*/" --include="*March*" --exclude="*" "$PWD"/ /dst/  
 
 
     
     
3
 
vote

Sugeriría crear primero su lista de archivos para incluir / excluir y luego hacer algo así como:

  public class AdminController : Controller {     public ActionResult LoadFoos()     {         if (Request.Files.Count > 0)         {             // This illustrates how to read the uploaded file contents,             // and would need to be adapted to your scenario             List<string> foos = new List<string>();              using (StreamReader reader = new StreamReader(Request.Files[0].InputStream))             {                 while (!reader.EndOfStream)                 {                     string line = reader.ReadLine();                      foos.Add(line);                 }             }              // TODO: use LINQ 2 SQL, NHibernate or ADO.NET to load the foos directly,             // or call a web/WCF service behind your firewall that does this         }          return View();     } } 4  

de

  public class AdminController : Controller {     public ActionResult LoadFoos()     {         if (Request.Files.Count > 0)         {             // This illustrates how to read the uploaded file contents,             // and would need to be adapted to your scenario             List<string> foos = new List<string>();              using (StreamReader reader = new StreamReader(Request.Files[0].InputStream))             {                 while (!reader.EndOfStream)                 {                     string line = reader.ReadLine();                      foos.Add(line);                 }             }              // TODO: use LINQ 2 SQL, NHibernate or ADO.NET to load the foos directly,             // or call a web/WCF service behind your firewall that does this         }          return View();     } } 5  

Para crear su lista, podría usar algo como:

  public class AdminController : Controller {     public ActionResult LoadFoos()     {         if (Request.Files.Count > 0)         {             // This illustrates how to read the uploaded file contents,             // and would need to be adapted to your scenario             List<string> foos = new List<string>();              using (StreamReader reader = new StreamReader(Request.Files[0].InputStream))             {                 while (!reader.EndOfStream)                 {                     string line = reader.ReadLine();                      foos.Add(line);                 }             }              // TODO: use LINQ 2 SQL, NHibernate or ADO.NET to load the foos directly,             // or call a web/WCF service behind your firewall that does this         }          return View();     } } 6  
 

I would suggest creating first your list of files to either include/exclude and then do something like:

rsync -avz --include-from=list.txt source/ destination/ 

of

rsync -avz --exclude-from=list.txt source/ destination/ 

To create your list you could use something like:

grep -r March /path > list.txt 
 
 
   
   
2
 
vote

lo descubrí. Uso de public class AdminController : Controller { public ActionResult LoadFoos() { if (Request.Files.Count > 0) { // This illustrates how to read the uploaded file contents, // and would need to be adapted to your scenario List<string> foos = new List<string>(); using (StreamReader reader = new StreamReader(Request.Files[0].InputStream)) { while (!reader.EndOfStream) { string line = reader.ReadLine(); foos.Add(line); } } // TODO: use LINQ 2 SQL, NHibernate or ADO.NET to load the foos directly, // or call a web/WCF service behind your firewall that does this } return View(); } } 7 Para reemplazar public class AdminController : Controller { public ActionResult LoadFoos() { if (Request.Files.Count > 0) { // This illustrates how to read the uploaded file contents, // and would need to be adapted to your scenario List<string> foos = new List<string>(); using (StreamReader reader = new StreamReader(Request.Files[0].InputStream)) { while (!reader.EndOfStream) { string line = reader.ReadLine(); foos.Add(line); } } // TODO: use LINQ 2 SQL, NHibernate or ADO.NET to load the foos directly, // or call a web/WCF service behind your firewall that does this } return View(); } } 8 y public class AdminController : Controller { public ActionResult LoadFoos() { if (Request.Files.Count > 0) { // This illustrates how to read the uploaded file contents, // and would need to be adapted to your scenario List<string> foos = new List<string>(); using (StreamReader reader = new StreamReader(Request.Files[0].InputStream)) { while (!reader.EndOfStream) { string line = reader.ReadLine(); foos.Add(line); } } // TODO: use LINQ 2 SQL, NHibernate or ADO.NET to load the foos directly, // or call a web/WCF service behind your firewall that does this } return View(); } } 9 y tuberías directamente a CGBitmapContextGetBitmapInfo()0 .

Terminé con lo siguiente:

  CGBitmapContextGetBitmapInfo()1  

AQUÍ CGBitmapContextGetBitmapInfo()2 y CGBitmapContextGetBitmapInfo()3 'NULL-TERMINA' Los datos según lo descrito por Gert van Den Berg (tengo que a causa de espacios). El CGBitmapContextGetBitmapInfo()4 parece redundante, ya que se incluye en CGBitmapContextGetBitmapInfo()5 , pero cuando se usa CGBitmapContextGetBitmapInfo()6 , se debe especificar para CGBitmapContextGetBitmapInfo()7 a sincronizar recursivamente.

Gracias a los chicos tanto, realmente lo aprecian.

 

I figured it out. Using find to replace ls and grep and piping directly to rsync.

I ended up with the following:

$ find . -type d -maxdepth 1 -name '*March*' -print0 | rsync -av0r --files-from=- ./ /dst/ 

Here -print0 and -0 'null-terminates' the data as described by Gert van den Berg (I have to because of spaces). The -r seems redundant as it is included in -a but when using --files-from it has to be specified for rsync to sync recursively.

Thank you guys so much, really appreciate it.

 
 

Relacionados problema

3  ¿Cómo empezan las carpetas RSYNC con un punto?  ( How do i rsync folders starting with a dot ) 
Estoy tratando de sincronizar un directorio maildir, que algunas carpetas dentro de este directorio maildir contiene un directorio que comienza con "DOT" ....

0  Cómo montar una partición copiada por RSYNC combinada de dos particiones de origen  ( How to mount an rsync copied partition combined from two source partitions ) 
Mi PC está ejecutando Archlinux. Mi PC tiene dos discos duros, / dev / sda y / dev / sdb. SDA es el disco de origen y contiene todos mis archivos. SDB es el d...

0  Cómo ejecutar RSYNC automatizado utilizando SSH2  ( How to run automated rsync using ssh2 ) 
Estoy tratando de configurar RSYNC entre dos máquinas sobre el protocolo SSH2. Anteriormente utilizamos SSH1 para RSYNC automatizado sin ninguna frase de cont...

0  No se pueden RSYNC archivos basados ​​en un patrón usando Java  ( Unable to rsync files based on a pattern using java ) 
Tengo una máquina remota de Linux que me gustaría tirar de los archivos con @SpringApplication0 basado en un patrón específico en el archivo en una máquina ...

29  rsync --delete - kiles-from = list / destr / no elimina archivos no deseados  ( Rsync delete files from list dest does not delete unwanted files ) 
Como puede ver en el título, trato de sincronizar una carpeta con una lista de archivos. Esperaba que este comando eliminaran todos los archivos en DEST / que...

0  ¿Cuál es la mejor utilidad / biblioteca / estrategia con Python para copiar archivos en varias computadoras?  ( What is the best utility library strategy with python to copy files across multi ) 
Tengo datos en varias computadoras almacenadas en carpetas. Muchas de las carpetas contienen 40-100 g de archivos de tamaño de 500 k a 125 MB. Hay unos 4 TB d...

0  ¿Cómo uso RSYNC para hacer una copia de seguridad de la carpeta "/ root" a un recurso compartido de red?  ( How do i use rsync to backup the root folder to a network share ) 
Una parte de mi unidad Iomega NAS se monta en un directorio local en My Home Server que ejecuta CentOS 6.4 AS / MNT / BACKUP-DRIVE utilizando AUTOFS y CIFS. ...

16  Problema de bash con eval, variables y citas  ( Bash problem with eval variables and quotes ) 
He estado leyendo acerca de las citas en Bash aquí y en todas partes, pero no tengo ayuda para resolver este problema. La cosa es que tengo un pequeño scrip...

-7  Tienda RSYNC ERROR EN VARIABLE  ( Store rsync error in variable ) 
He escrito un script bash para sincronizar copias de seguridad con un almacenamiento local, el script comprueba si se realizó una copia de seguridad en el día...

12  Uso de Emacs Tramp vs. RSYNC para el desarrollo remoto  ( Using emacs tramp vs rsync for remote development ) 
He estado haciendo algún desarrollo remoto utilizando Emacs Tramp y encontré que era bastante lento. Cada vez que guardo un archivo, tarda unos 10 segundos pa...




© 2022 respuesta.top Reservados todos los derechos. Centro de preguntas y respuestas reservados todos los derechos