rcp & rmv: Copiar y mover con rsync, tan simple como cp y mv

Descubre rcp y rmv, dos funciones de shell que reemplazan cp y mv usando rsync para copiar y mover con barra de progreso y opciones avanzadas en tus scripts y automatización.

9 sept 2025 • 2 min read • Q2BSTUDIO Team

Inteligencia-Artificial-

Presentamos rcp y rmv dos pequeñas funciones de shell que actúan como reemplazo directo de cp y mv aprovechando la potencia de rsync para copiar y mover archivos con una barra de progreso y opciones avanzadas

En lugar de ejecutar comandos largos como rsync -avh --partial --info=progress2 source dest o rsync -avh --partial --info=progress2 --remove-source-files source dest ahora puedes ejecutar de forma simple rcp source dest y rmv source dest

También puedes añadir opciones extra de rsync por ejemplo para compresión o simulación rcp -z source dest rmv --dry-run source dest

Ejemplo de funciones para pegar en .zshrc o .bashrc

alias rsync=/opt/homebrew/bin/rsync

rcp() { local options=-avh --partial --info=progress2 local source_path=$1 local dest_path=$2 if [[ -n $2 ]] ; then shift 2 rsync $options $@ $source_path $dest_path else echo Usage: rcp [rsync_options] source destination return 1 fi }

rmv() { local options=-avh --partial --info=progress2 --remove-source-files local source_path=$1 local dest_path=$2 if [[ -n $2 ]] ; then shift 2 rsync $options $@ $source_path $dest_path && find $source_path -type d -empty -delete else echo Usage: rmv [rsync_options] source destination return 1 fi }

Nota para usuarios de macOS: la versión de rsync que viene por defecto puede ser antigua y no soporta --info=progress2. Instala la versión moderna con brew install rsync y asegúrate de que el alias rsync apunte al binario instalado si es necesario. Por ejemplo /usr/bin/rsync --version openrsync: protocol version 29 rsync version 2.6.9 compatible y /opt/homebrew/bin/rsync --version rsync version 3.4.1 protocol version 32

Sobre la eliminación de directorios vacíos: la opción --remove-source-files de rsync no elimina directorios vacíos tras mover los archivos, por eso rmv ejecuta un find para borrar los directorios vacíos una vez finalizada la transferencia

En Q2BSTUDIO somos expertos en desarrollo de software y en crear soluciones prácticas que mejoran la productividad. Si necesitas integrar herramientas de sincronización o automatizar procesos a medida podemos ayudarte con soluciones de software a medida y aplicaciones a medida y con proyectos de automatización de procesos que incluyan agentes IA y flujos que utilicen rsync u otras herramientas

Ofrecemos también servicios de inteligencia artificial ia para empresas agentes IA ciberseguridad pentesting servicios cloud aws y azure servicios inteligencia de negocio power bi y consultoría para implantar soluciones seguras y escalables

Si buscas una alternativa sencilla a cp y mv que incorpore reintentos compresión transferencia incrementales y una visualización clara del progreso rcp y rmv son una opción muy práctica y fácil de incorporar a tus scripts y flujos de trabajo

Prueba las funciones adapta las opciones de rsync a tus necesidades y contacta con Q2BSTUDIO para desarrollar integraciones personalizadas en proyectos de software a medida inteligencia artificial ciberseguridad o servicios cloud

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Artificial intelligence

AI agents, chatbots, and intelligent assistants that automate tasks and serve your customers 24/7 to improve the efficiency of your business.

More info

Software Development

Web, mobile, and desktop applications, intranets, e-commerce, SaaS, and management platforms designed for your company's specific needs.

More info

Cloud services

Migration, infrastructure, managed hosting, high availability, and security on Microsoft Azure and Amazon Web Services to help your business scale without limits.

More info

Cybersecurity and pentesting

Security audits, penetration testing and protection of applications, data and infrastructure on-premise and cloud, with ethical hacking and regulatory compliance.

More info

Business Intelligence

Dashboards and data analysis with Power BI: we integrate your sources, design dashboards and KPIs and turn your data into decisions.

More info

Process automation

We automate repetitive tasks and connect your applications with n8n, Power Automate, Make, and RPA, eliminating manual work and increasing productivity.

More info

Training for Companies

We train your teams in technology with criteria: web development, databases, Git, best practices and security, automation with n8n, artificial intelligence for companies and creation of AI solutions with Azure AI Foundry.

More info

Code Auditing

We audit the code that you, your team or an AI create: we tell you what is good and what to improve, we secure it and make it ready for production, web or app.

More info

AI Image Generation

We create for you the images that your business needs with artificial intelligence: product, networks, advertising, illustration and avatars. You tell us what you want and we deliver it ready to use.

More info

AI Video Generation

We create videos with artificial intelligence for you: promotional, networking, virtual presenters, dubbing and animations. You tell us the idea and we will deliver it assembled and ready to publish.

More info

AI Conversational Avatars

We create conversational avatars with AI – digital humans with a face and voice – that serve your customers and teams with the knowledge of your company, on your website, interactive monitors, WhatsApp or Teams.

More info

Online Marketing and AI

Google Ads, Meta Ads, LinkedIn Ads and AI Engine Positioning (GEO/AEO): we attract customers and make your brand appear where they search for you, also on ChatGPT, Gemini and Perplexity.

More info

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.